An R package for creating interactive web-based graphs via plotly's JavaScript graphing library.
plotly is not (yet) available on CRAN, but you can install it via devtools:
devtools::install_github("ropensci/plotly")If you use ggplot2, simply call ggplotly() to convert your ggplot to an interactive, web-based version!
library(plotly)
set.seed(100)
d <- diamonds[sample(nrow(diamonds), 1000), ]
p <- ggplot(data = d, aes(x = carat, y = price)) +
geom_point(aes(text = paste("Clarity:", clarity))) +
geom_smooth(aes(colour = cut, fill = cut)) + facet_wrap(~ cut)
(gg <- ggplotly(p))Click here to interact with the resulting graph (notice the custom hover text!)
plotly also supports certain chart types that ggplot2 doesn't support (such as 3D surface, point, and line plots). You can easily create these (or any other plotly) charts using the high-level interface.
plot_ly(z = volcano, type = "surface")The ggplotly() function converts a ggplot object to a plotly object, so if you like, you may 'post-process' your ggplot graphs to add custom plotly features, for example:
layout(gg, hovermode = "closest")- An overview of plotly's R API
- Peruse the examples on plotly's R homepage and ggplot2 homepage
- We love collaboration! See the wiki and the code of conduct for more information.



