Interactive 3D in Shiny (shinyRGL)

[This article was first published on Trestle Technology » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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.

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 about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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)