[R] Offscreen rendering in RGL?

Matthew Neilson matt at gneilson.plus.com
Sun Jun 27 18:58:14 CEST 2010


Hi there,

I've written a script for reading 3D simulation data into R, rendering  
it using RGL, and then saving the resulting plot using the  
snapshot3d() function. The results are fantastic! However, whenever  
RGL plots anything it automatically brings the viewing window into  
focus. Since I'm producing a large number of plots in a loop, my  
machine becomes almost unusable for the duration of the script.

When producing 2D plots in R (i.e. not using RGL), I can easily call  
the pdf() function before each plot (and then close it with the  
dev.off() function) so that the plot is written directly to a file,  
thus bypassing the display. This allows me to set scripts running in  
the background, so that I can get on with other things. ;)

Is there a way of forcing RGL to draw to an "invisible" (virtual, or  
buffered?) display that can then be saved using the snapshot3d()  
function?

Many thanks,

-Matt



More information about the R-help mailing list