WebGL in Shiny

Shiny wrappers for RGL (WebGL) in R

View project onGitHub

Introduction

ShinyRGL is a Shiny wrapper for the RGL package. This package enables users to create Shiny apps that use interactive 3D graphics in WebGL using the RGL package. The implementation can be as simple as adding lines like the following:

ui.R

...
  # Create an output element (works just like 'plotOutput()')
  webGLOutput("myWebGL")
...

server.R

...
  output$myWebGL <- renderWebGL({
    points3d(1:10, 1:10, 1:10)
    axes3d()
  })
...

Add this to your Shiny app, and you should see something like the following:

You must enable Javascript to view this page properly.

Examples

The package ships with two examples:

3D Scatterplot

Code is available here

3D Bivariate Normal Distribution

Code is available here

Installation

You can install the latest version of the code using the devtools R package.

# Install devtools, if you haven't already.
install.packages("devtools")

library(devtools)
install_github("shinyRGL", "trestletech")

# OPTIONAL (for persistent viewpoint between WebGL scene refreshes)
install_github("rgl", "trestletech", "js-class")

License

The development of this project was generously sponsored by the Institut de Radioprotection et de Sûreté Nucléaire and performed by Jeff Allen. The code is licensed under The MIT License (MIT).

Copyright (c) 2013 Institut de Radioprotection et de Sûreté Nucléaire

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.