[R] png output in batch

Prof Brian D Ripley ripley at stats.ox.ac.uk
Thu Oct 26 08:31:54 CEST 2000

On Wed, 25 Oct 2000, Deborah Swayne wrote:

> I'm trying to use R in a cgi script to produce graphics
> files in png format, and I'm having a problem.
> My shell command line looks like this:
>   R </usr/dfs/auction/eligibility.R --no-save  >/tmp/R.out
> and the line in the R script looks like this:
>  png ("foo.png", pointsize=18)
> If I run outside the cgi context, it runs great.  When
> run as in a cgi script, I get this error message:
> Error in X11(paste("png::", filename, sep = ""), width, height, pointsize,  : 
>         unable to start device PNG
> Is there any way to trick this command into doing what I want?
> I can alternatively produce postscript output, and then
> convert to png, but I find the resolution disappointing.
> (I'm using unix.)

There is no way.  png() on Unix depends on having an X server (for the
fonts, basically).  I would use bitmap(), which does produce postscript
output and convert, but you can control the resolution.  (I would
use it even in interactive use.)

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list