Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
To save a bitmap image of a plot created with rgl, use rgl.snapshot().
This will capture the exact image that is on the screen:
library(rgl)plot3d(mtcars$wt,mtcars$disp,mtcars$mpg,type="s",size=0.75,lit=FALSE)rgl.snapshot('3dplot.png',fmt='png')
You can also use rgl.postscript() to
save a Postscript or PDF file:
rgl.postscript('figs/miscgraph/3dplot.pdf',fmt='pdf')rgl.postscript('figs/miscgraph/3dplot.ps',fmt='ps')
Postscript and PDF output does not support many features of the OpenGL library on which rgl is based. For example, it does not support transparency, and the sizes of objects such as points and lines may not be the same as what appears on the screen.