I am trying to embed ggplot style graphs on a webpage online. I use ggplot to create a graph, run it through ggplotly
, and then paste the plotly_json into my page. I’ve found that the online version of plotly renders differently than the one in Rstudio. The one in Rstudio renders the ggplotly type correctly, but the online one does not render the axis labels.
Here is an example of creating a ggplotly. Note that it has y axis and x axis labels
library(reshape2)
library(plotly)
p <- ggplot(tips, aes(x=total_bill, y=tip/total_bill)) + geom_point(shape=1)
# Divide by day, going horizontally and wrapping with 2 columns
p <- p + facet_wrap( ~ day, ncol=2)
p <- ggplotly(p)
p
When I render it online I don’t see the axis labels.
https://plot.ly/~jeffreyw/1/#/
This seems to only be a problem when the ggplot includes a facet_wrap.
I know it is possible to do this correctly, because it renders properly at https://plot.ly/ggplot2/facet_wrap/