Show Sidebar Hide Sidebar

WebGL vs SVG in R in R

How to create plots using WebGL

New to Plotly?

Plotly's R library is free and open source!
Get started by downloading the client and reading the primer.
You can set up Plotly to work in online or offline mode.
We also have a quick-reference cheatsheet (new!) to help you get started!

Version Check

Version 4 of Plotly's R package is now available!
Check out this post for more information on breaking changes and new features available in this version.

library(plotly)
packageVersion('plotly')
## [1] '4.9.1'

WebGL vs SVG in R

Recent versions of the R package include the toWebGL() function, which converts any eligible SVG graph into a WebGL plot. With WebGL, we can render way more elements in the browser.

WebGL with 50,000 points

library(plotly)
p <- ggplot(data = diamonds, aes(x = carat, y = price, color = cut)) +
  geom_point(alpha = 0.01)
p <- ggplotly(p) %>% toWebGL()

p