Here is a paper that describes rgl package in detail. And here I will just attach some code to show how to install the package and quickly plot a few proof of concept plots in 3D and it is really a fun experience to draw the plot yourself and interact with it, rotate, flip, zoom in zoom out…etc.
> library(“rgl”)
> ?rgl.spheres
> open3d()
> spheres3d(rnorm(10), rnorm(10), rnorm(10), radius=runif(10), color=rainbow(10))
> rgl.open()
> rgl.points(rnorm(1000), rnorm(1000), rnorm(1000), color=heat.colors(1000))
If you are using Mac, you probably need to have X11 (XQuartz) pre-installed and here are the outputs from the commands above, it won’t be printed to the Plots/Viewer panel if you are using RStudio, and it will be a new window for each open3d() command.