Three.js widgets for R and shiny. The package includes
The widgets are easy to use and render directly in RStudio, in R markdown, in Shiny applications, and from command-line R via a web browser. They produce high-quality interactive visualizations with just a few lines of R code.
Visualizations optionally use accelerated WebGL graphics, falling back to non-accelerated graphics for systems without WebGL when possible.
See https://threejs.org for details on three.js.
See https://bwlewis.github.io/rthreejs for R examples.
This project is based on the htmlwidgets package. See http://htmlwidgets.org for details and links to many other visualization widgets for R.
The new 0.3.0 package version introduces major changes. The
scatterplot3js() function generally works as before but with more capabilities. The
graphjs() function is very different with a new API more closely tied to the igraph package.
See https://bwlewis.github.io/rthreejs/animation/animation.html and https://bwlewis.github.io/rthreejs/advanced/advanced.html for short tutorials on the new graph animation capabilities.
graphjs() is generally much improved using extensive buffering and custom WebGL shaders where needed. See https://bwlewis.github.io/rthreejs/ego/index.html for an example.
scatterplot3js() function was substantially improved and updated.
pchoption supports many point styles with size control.
points3d()interface has changed to support pipelining.
use.orbitcontrols=TRUEoption for more CPU-efficient (but less fluid) rendering (good for laptops), also applies to
graphjs() function is completely new.
Use the devtools package to install threejs directly from GitHub on any R platform (Mac, Windows, Linux, …). You’ll need the ‘devtools’ package.
if(!require("devtools")) install.packages("devtools") devtools::install_github("bwlewis/rthreejs")
?scatterplot3d for more examples and detailed help.
z <- seq(-10, 10, 0.1) x <- cos(z) y <- sin(z) scatterplot3js(x, y, z, color=rainbow(length(z)))
The following example plots an undirected graph with 4039 vertices and 88234 edges from the Stanford SNAP network repository http://snap.stanford.edu/data/facebook_combined.txt.gz.
data(ego) graphjs(ego, bg="black")
For detailed help on the widgets and additional examples, see
?scatterplot3js ?globejs ?graphjs