Not all facets being shown with facet_wrap, boxplot and ggplotly
@cpsievert I'm seeing several open issues that are similar to this one (#1132, #1962, #1301, #1254, #1243, #1099, #1086, #897) and wasn't sure whether to add a new issue or not.
It seems like perhaps plotly is having some trouble with facet_wrap() -- my reprex is pretty simple. On my machine using the development (and non-development) version of plotly some facets are not being shown.
The images below are from plotly 4.9.4.9000.
library(ggplot2)
p <- ggplot(mtcars, aes(y = mpg)) + geom_boxplot() + facet_wrap(~cyl)
plotly::ggplotly(p)
Just ggplot2 (no plotly)

ggplotly (missing a couple of boxes)

The issue is that the box plots are placed at the wrong position, i.e. outside of the visible x axis range (You can see them by shifting the range using the slider):
Until this is fixed a workaround would be to explicitly map a constant on the x aes:
library(ggplot2)
p <- ggplot(mtcars, aes(x = 1, y = mpg)) +
geom_boxplot() +
facet_wrap(~cyl)
plotly::ggplotly(p)

Created on 2024-08-05 with reprex v2.1.0