0

I'm trying to use ggplotly() with ggplot() to create a faceted graph without gridlines, like this:

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

But when I use ggplotly, the grid lines remain:

ggplotly(p) 

Even when I try to get rid of them using calls to layout:

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))

Is this a bug? How can I solve it?

enter image description here

Nova
  • 5,423
  • 2
  • 42
  • 62
  • 1
    Cannot reproduce this. Maybe update the package. – Martin Schmelzer Apr 10 '18 at 14:08
  • I've got the dev version of ggplot2 and newest version of plotly. – Nova Apr 10 '18 at 14:34
  • I've got `plotly 4.7.1.9000` and `ggplot2 2.2.1.9000` – Martin Schmelzer Apr 10 '18 at 14:35
  • Thanks. I'm at `plotly 4.7.1` and `ggplot2 2.2.1.9000`. You've got the dev version of plotly? – Nova Apr 10 '18 at 14:58
  • Originally, I couldn't reproduce either. But after being prompted by ggplot2 to update to the dev version, the grid lines are showing like above. It might be a bug, you could [open an issue in Github](https://github.com/tidyverse/ggplot2/issues). – csgroen Apr 10 '18 at 14:59
  • Good plan. But should I post about it in the [plotly Github](https://github.com/ropensci/plotly) instead of ggplot2? – Nova Apr 10 '18 at 15:22

0 Answers0