Using rgl with headless display
This seems to be intimately intertwined with the rgl
package. Suppose we toss Xvfb
and friends in favor of Cairo
and substitute plot3D
for rgl
:
library(Cairo)library(plot3D)CairoPDF()x <- sort(rnorm(1000))y <- rnorm(1000)z <- rnorm(1000) + atan2(x, y)scatter3D(x, y, z)dev.off()
This still needs to run under X11 (i.e. xterm) but avoids bringing up an X11 window and leaves a PDF plot behind in Rplots.pdf
(you can control the file names, of course along with lots of the other details of the plot.)
(Converted to JPEG for insertion here, but it is truly a PDF.)