[R] Calling R from a non-X shell script to plot?
doktora v
doktora at gmail.com
Mon Dec 13 18:25:01 CET 2004
I am trying to run R from an apache C++ module in a shell script to
plot some data to display it in apache later. I get the error
(reported in apache's logs):
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
Error in X11(paste("png::", filename, sep = ""), width, height, pointsize, :
unable to start device PNG
In addition: Warning message:
unable to open connection to X11 display`'
Execution halted
Is anyone familiar with this (i.e. running R from a non-X
environment)? Is there a way to get around this? I've seen some stuff
about virtual devices, but have no idea if it works or where to
start. If there is a simpler solution, please let me know.
-- doktora
I run the following shell script from the apache module using execve:
------------------------------------------------------
DISPLAY=:0.0
export DISPLAY
if $R --vanilla --quiet < $rfile >$log ; then
echo "Success"
else
echo "There were errors in $0, see $log"
fi
------------------------------------------------------
And $rfile contains this:
------------------------------------------------------
png(filename = "/tmp/plot.png", width = 510, height = 360);
plot(<some graph>)
dev.off()
More information about the R-help
mailing list