I'm trying to turn a ggplot plot into an interactive plotly for an R Markdown HTML presentation.
If 'a' is my ggplot, the important bit of code looks like:
x <- list(title = "Title 1")
y <- list(title = "Title 2")
plotly::ggplotly(a + ylab("") + xlab("")) %>% plotly::layout(xaxis = x, yaxis = y)
I used plotly::layout() as the axes titles I provided in the ggplot plot disappeared/overlapped when ggplotly was applied.
As you can see this gets me most of the way there, but it seems like the axis labels are centered on the top left facet and not the plot as a whole. The plot was faceted very simply with a facet_wrap(~var).
Is there a way to have the axis titles move into the center? (y axis title between the two left hand facets, x axis title under the middle facet)