我在ggplotly中遇到传奇问题。这就是我的意思:
library(reshape2) # for melt
df <- melt(outer(1:4, 1:4), varnames = c("X1", "X2"))
p1 <- ggplot(df, aes(X1, X2)) + geom_tile(aes(fill = value))
p2 <- p1 + guides(fill = guide_legend(title = "LEFT", title.position = "left")) p2
ggplotly(p2)
我制作了更复杂的ggplot,并且我的传奇很多。在ggplotly中,我看不到任何变化。
非常感谢!
答案 0 :(得分:0)
正如MLavoie
所述,您可以尝试扩展边距(https://plot.ly/r/reference/#layout-margin):
library(reshape2) # for melt
df <- melt(outer(1:4, 1:4), varnames = c("X1", "X2"))
p1 <- ggplot(df, aes(X1, X2)) + geom_tile(aes(fill = value))
p2 <- p1 + guides(fill = guide_legend(title = "LEFT", title.position = "left"))
ggplotly(p2) %>% layout(margin=list(r=120))