[R] png-generation from script (non-X11 env) now broken?

David Wolfskill r at catwhisker.org
Tue Feb 25 19:36:29 CET 2014

Since ... hmmm.. May 2012, I've had a cron-initiated script running
monthly to extract some data and generate some numeric tables and
plots (in PNG format).

In its "normal" mode, the script automagically sends its results
to a small handful of managers on the first of each month.  Out of
self-defense, I set up a "preview" run several days before the real
one; the preview doesn't go quite as high in the management chain.

This morning, I found a message in my mailbox from such a preview run:

| Error in .External2(C_X11, paste("png::", filename, sep = ""), g$width,  :
|   unable to start device PNG
| Calls: gen_build_histogram -> png
| In addition: Warning message:
| In png(filename = fn, height = height, width = width, units = "in",  :
|   unable to open connection to X11 display ''
| Execution halted

[This was running R-3.0.2_1 in FreeBSD/amd64 9.2-STABLE 
r262323M/262357:902506, built Sun Feb 23 05:14:37 PST 2014.]

I admit that I haven't been following changes in R very closely --
the script had been running reliably for over a year, and it's not
one of the fires I've been fighting recently.

But the implication -- that png() was suddenly[1] changed so that it
requires the ability to connect to an X11 display -- seemed peculiar
enough that I would have thought a quick search would lead me to soe
discussion of a change of this magnitude, rationale, and what folks
might do to mitigate the effects.

Based on one message I found (from 02 Mar 2008!), I did take a look at
"help png" output, and saw the reference there to bitmap().  I tried ...
hacking ... my functions to use "bitmap(fn, ...)" instead of
"png(filename = fn, ...)", but that looks as if it's leading me astray:

| Error in strwidth(legend, units = "user", cex = cex, font = text.font) : 
|   family 'mono' not included in postscript() device
| Calls: gen_build_histogram -> legend -> strwidth
| Execution halted

So... what's someone who wants to use R to generate PNG-format files
from an environment that is bereft of X11 to do?

1: "Suddenly" because it *had* been working up to 01 Feb 2014, at least.

[I'll be happy to sumamrize responses that aren't sent to the list.]

David H. Wolfskill				r at catwhisker.org
Taliban: Evil cowards with guns afraid of truth from a 14-year old girl.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 964 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20140225/cec993d7/attachment.bin>

More information about the R-help mailing list