Install from CRAN:
Or install the latest development version (on GitHub) via devtools:
Web-based ggplot2 graphics
If you use ggplot2,
ggplotly() converts your plots to an interactive, web-based version! It also provides sensible tooltips, which assists decoding of values encoded as visual properties in the plot.
library(plotly) g <- ggplot(faithful, aes(x = eruptions, y = waiting)) + stat_density_2d(aes(fill = ..level..), geom = "polygon") + xlim(1, 6) + ylim(40, 100) ggplotly(g)
plotly's custom R interface
plot_ly(z = ~volcano, type = "surface")
Capturing plotly events
plotly.js exposes a number of 'standard' events that work consistently across plot types. It's easy to hook into these events using the
event_data() function in shiny apps, as these examples demonstrate:
You can also hook into these events without shiny using
Please read through our contributing guidelines. Included are directions for opening issues, asking questions, contributing changes to plotly, and our code of conduct.