TMS TMS - 4 months ago 13x
Linux Question

creating PNG plots on the linux terminal

I have an R script that I run on a linux server (Debian Wheezy 7.7). This script is meant to do some computations and generate plots into PNGs. Unfortunatelly I get an error:

> savePlot("myplot", "png")
Error in savePlot("myplot", "png") :
can only copy from 'X11(type="*cairo")' devices

How do I get around this? I am only connected from Win XP with PuTTy, I don't have any X-windows set up on my XP and I don't want to bother with this - all I need is to run the script and produce the PNGs. Thanks!


You may have more luck calling the device internally:


If you don't want to bother with opening an instance of R, you could save the above script (e.g. "script.01.R") and run the following from the console:

R CMD BATCH script.01.R

This should also work to create the .png.