Show Sidebar Hide Sidebar

Plotly R Library

Plotly's R graphing library makes interactive, publication-quality graphs online. Examples of how to make line plots, scatter plots, area charts, bar charts, error bars, box plots, histograms, heatmaps, subplots, multiple-axes, and 3D (WebGL based) charts.

Version 4:

We've recently released version 4 of our package on CRAN. Check out this post for more information about changes and features available in this version!

library(plotly)
set.seed(100)
d <- diamonds[sample(nrow(diamonds), 1000), ]
plot_ly(d, x = ~carat, y = ~price, color = ~carat,
        size = ~carat, text = ~paste("Clarity: ", clarity))

Plotly graphs are interactive:

Click-drag to zoom, shift-click to pan, double-click to autoscale.

ggplot2 Integration:

Know and love ggplot2? Try ggplotly

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)

ggplotly(p)
Plotly Fundamentals
Basic Charts
Statistical Charts
Scientific Charts
Financial Charts
Maps
3D Charts
Multiple Axes, Subplots, and Insets
Add Custom Controls
Animations
Streaming
Style Options
Layout Options
Add Custom Controls with JavaScript

All Plotly charts have click, hover and zoom events exposed to add custom controls with Plotly's JavaScript postMessage API.

Image Export & Retrieving Plots
Still need help?
Contact Us

For guaranteed 24 hour response turnarounds, upgrade to a Developer Support Plan.