Skip to content

dynamicticks = T & faceting #1416

Open
Open
@Hovav-Dror

Description

@Hovav-Dror

Trying facet_wrap with a categorical y axis and dynamicTicks =TRUE ends in:
Error in tickvals - val : non-numeric argument to binary operator

ggplot is OK, only ggplotly returns the problem

Ideas?

db <- data_frame(
  x = c("a1", "b", "c1", "a2", "b", "c2"),
  Var = c("a", "a", "a", "b", "b", "b"),
  n = c(70, 50, 30, 30, 50, 70)
)
p <- db %>% 
  ggplot(aes(x = reorder(x,n), y = n)) +
  geom_col() +
  coord_flip()  +
  facet_wrap(~Var, scales = "free")
p
ggplotly(p, dynamicTicks = TRUE)

Now, if you wonder why I want to use dynamicTicks in the first place, see this example:

db <- data_frame(
  s = paste0(sample(LETTERS, 2000, replace = T), sample(LETTERS, 2000, replace = T)),
  x = sample(s[1:100], 2000, replace = T)
)

db %>% count(x, sort = T) %>% 
  ggplot(aes(x = reorder(x,n), y = n)) +
    geom_col() +
  coord_flip()

ggplotly(dynamicTicks = TRUE)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions