An interactive graphing library for R

License: Other

Language: R

Keywords: d3js, data-visualization, ggplot2, javascript, plotly, r, r-package, rstats, shiny, webgl

Build Status


An R package for creating interactive web graphics via the open source JavaScript graphing library plotly.js.


Install from CRAN:


Or install the latest development version (on GitHub) via devtools:


Getting Started

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.

g <- ggplot(faithful, aes(x = eruptions, y = waiting)) +
  stat_density_2d(aes(fill = ..level..), geom = "polygon") + 
  xlim(1, 6) + ylim(40, 100)

If you'd like to see how ggplotly() does in converting different ggplot2 examples, we host a plotly version of the official ggplot2 documentation. We also have some of our own examples here.

plotly's custom R interface

plotly.js supports some chart types that ggplot2 doesn't (our cheatsheet provides a nice summary of the available chart types). You can create any of these charts via plot_ly().

plot_ly(z = ~volcano, type = "surface")

We have a number of vignettes which explain the plot_ly() interface in depth as well as numerous examples on the plotly website and bundled with the package.

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:

  1. 2D events (source)
  2. Linked Clicks (source)
  3. Linked Brush (source)

You can also hook into these events without shiny using htmlwidgets::onRender() (example). This, however, requires JavaScript knowledge and makes it much harder to coordinate views between htmlwidgets.

Learn more

We have lots of examples on and, but a more comprehensive review is also available at


Please read through our contributing guidelines. Included are directions for opening issues, asking questions, contributing changes to plotly, and our code of conduct.

Project Statistics

Sourcerank 9
Repository Size 93.2 MB
Stars 1,498
Forks 520
Watchers 117
Open issues 255
Dependencies 58
Contributors 21
Tags 11
Last updated
Last pushed

Top Contributors See all

Carson Sievert Marianne Corvellec pedrodz Chris Parmer xsaintmleux Baobao Zhang Karthik Ram Scott Chamberlain Joe Cheng msund Toby Dylan Hocking Sergio Oller Tal Galili McClelland Legge timelyportfolio nielsenmarkus11 Martin John Hadley Dex Groves Alexey Stukalov nikolai

Recent Tags See all

v4.5.6 November 17, 2016
v4.5.2 September 26, 2016
v3.6.1 May 18, 2016
v3.6.0 May 18, 2016
v3.5.5 May 05, 2016
v3.5.4 May 05, 2016
v3.5.3 May 02, 2016
v3.5.2 May 02, 2016
v3.5.1 April 26, 2016
v3.4.13 April 12, 2016
0.3 November 26, 2013

Interesting Forks See all

Create interactive web graphics from R via plotly's JavaScript graphing library
R - Last pushed - 3 stars - 1 forks
An interactive graphing library for R
R - Updated - 1 stars
An interactive graphing library for R
R - Updated - 1 stars
Create interactive web graphics from R via plotly's JavaScript graphing library
R - Published - 1 stars
Create interactive web graphics from R via plotly's JavaScript graphing library
R - Updated - 1 stars

Something wrong with this page? Make a suggestion

Last synced: 2016-05-27 18:02:12 UTC

Login to resync this repository