plotly.R
plotly.R copied to clipboard
Interactive facets in ggplotly
Currently a plot like this:
library(reshape2)
library(plotly)
p <- ggplot(tips, aes(x=total_bill, y=tip/total_bill)) + geom_point(shape=1)
p <- p + facet_wrap( ~ day, ncol=2)
fig <- ggplotly(p)
fig
does not have any interactive elements for the facets. A few improvements would be:
- Show a dropdown list with the title of the facets to allow selecting one facet or "All" (there does not seem to be an easy way nor an example to do this)
- Click in the facet title shows only that subplot (zooms). The user can reset the zoom as usual.
- Show a list of facet title that work similar to the legend: single-click shows/hides the facet, double-click shows only this facet/shows all facets.