ggplotly不尊重任何删除网格线的调用

时间:2018-04-10 14:02:57

标签: r ggplot2 gridlines ggplotly

我正在尝试使用ggplotly()和ggplot()创建一个多面图没有网格线,如下所示:

library(ggplot2)
library(plotly)

p <- iris %>% 
  ggplot(aes(Sepal.Length, Sepal.Width, color = Species)) +
  geom_point() +
  facet_wrap(~Species) +
  theme_bw() +
  theme(panel.grid = element_blank())

p

enter image description here

但是当我使用ggplotly时,网格线仍然存在:

ggplotly(p) 

即使我试图使用布局调用来摆脱它们:

ggplotly(p) %>% layout(xaxis = list(automargin=TRUE, showgrid = F), 
                       yaxis = list(automargin=TRUE, showgrid = F),
                       margin = list(l = 100, b = 100))

ggplotly(p) %>% layout(xaxis = list(automargin=TRUE, gridcolor = "white"), 
                       yaxis = list(automargin=TRUE, gridcolor = "white"),
                       margin = list(l = 100, b = 100))

这是一个错误吗?我该如何解决?

enter image description here

0 个答案:

没有答案