-
Notifications
You must be signed in to change notification settings - Fork 636
Closed
Description
Legends are truncated when using orientation = "h" and setting any value for the left margin. This is the only instance where this has occured, and it's a bit of a problem when we want to adjust the left margin. I'm guessing it's a bug?
Example:
# loading dplyr
library(dplyr)
# some data. create factor variable with longer names (Diet)
ChickWeight2 <- ChickWeight %>%
ungroup() %>%
mutate(Diet = factor (Diet,labels =c("diet 1","diet 2", "diet 3", "diet 4" ))) %>%
mutate(Time = as.Date(Time, origin = "2010-11-21")) %>%
group_by(Time , Diet) %>%
summarise(weight = mean(weight))
# No problems here, when we don't set any value for the left margin.
plotly::plot_ly(ChickWeight2, x = ~Time, y = ~weight, color = ~Diet,
type ="scatter",
mode="line",
colors = c("red","blue","green", "orange")) %>%
plotly::layout(legend = list (orientation="h"),
xaxis = list (title=FALSE) ,
margin=list())
# Now with left margin, all legends are sometimes in one row (as in this example), and "diet 4" is truncated
plotly::plot_ly(ChickWeight2, x = ~Time, y = ~weight, color = ~Diet,
type ="scatter",
mode="line",
colors = c("red","blue","green", "orange")) %>%
plotly::layout(legend = list (orientation = "h"),
xaxis = list (title = FALSE) ,
margin=list(l = 0))Metadata
Metadata
Assignees
Labels
No labels

