Interactive 3D in Shiny (shinyRGL)

October 13, 2013

(This article was first published on Trestle Technology » R, and kindly contributed to R-bloggers)

The rgl package has been used to produce rich, interactive 3D graphics within R using the OpenGL framework for some time. The rgl authors also added the ability to export to WebGL, allowing R authors to produce interactive 3D graphics that were accessible from within any modern web browser.

This functionality can now be leveraged within the Shiny framework using the new shinyRGL package — allowing users of R who may have no prior web development experience to create interactive web applications which incorporate 3D graphics. Examples such as this 3D cube filled with variable numbers of points or this modification of the ‘bivar’ example included in rgl can be produced with minimal effort. (The source code for both of these applications is available in the /examples/ directory of the shinyRGL package; both are under 100 lines of code and are written entirely in R.)

The package was just released on CRAN and should now be available from your preferred CRAN mirror. You can install using the command:


Alternatively, you can download the bleeding-edge version of the code, view more details about the implementation, or track the development of the package on our GitHub repository. Please use GitHub to notify us of any issues or feature requests you may come across, as well.

Below is a sample of the kinds of graphics that can be produced using shinyRGL by writing only R code. Be sure to pan the scene by clicking and dragging, zoom using the scroll wheel, and even change the point of view by clicking and dragging with the right mouse button.

Your browser does not support the HTML5 canvas element.

You must enable Javascript to view this page properly.

To leave a comment for the author, please follow the link and comment on their blog: Trestle Technology » R. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)