How to prevent x axes overlap ggplotly with facet_wrap(~variable)

Viewed 479

I have some data that looks nice when plotted with ggpglot but the x-axes and the plots underneath overlap in plotly::ggplotly().

library(gapminder)
library(plotly)
p <- ggplot(gapminder, aes(x=gdpPercap, y=lifeExp)) + geom_point() + scale_x_log10()
p <- p + aes(color=continent) + facet_wrap(~year,scale="free")
gp <- ggplotly(p)
gp

So I've been trying this: R: ggplot and plotly axis margin won't change

Basically I need to increase the white space between each graph object and the one below. Any thoughts would be much appreciated.

enter image description here

1 Answers
Related