[R] Background color with jpeg and png devices

Trent Piepho xyzzy at speakeasy.org
Fri Sep 15 23:41:14 CEST 2000


On Fri, 15 Sep 2000, Prof Brian Ripley wrote:
> On Fri, 15 Sep 2000, Prof Brian Ripley wrote:
> > On Thu, 14 Sep 2000, Trent Piepho wrote:
> > > If I change the background color of a plot, with par(bg="red") for example, I
> > > get a plot with a red background when I use the postscript or X11 devices. 
> 
> Well, I don't in postscript, just invalid postscript (in 1.1.1 and
> R-devel).  The problem is that /fg must be set before /p2 is used, and
> that is used to set the background colour via PS_Rect (and the problem
> occurs in a couple of other places too).

If I use the bitmap device, under R-1.1.0, I get a png file with the correct
background color.  I thought bitmap didn't work 1.1.0, but I'm not
complaining.

> (It's a one-line fix for png, but bitmap fails because postscript does.
> In X11_NewPage, copy the line from the second section setting xd->bg
> to the first section.)

And after applying this fix, I get the proper background color with png() too.

I'm trying to use R to generate dynamic content for web pages.  I wanted to
use the png device to avoid the overhead of the PS->png translation with
ghostscript.  However, since png requires an X server to generate the
graphics, maybe that's a bad choice.  I'd need to leave something like Xvfb
running to provide a virtual X server on the web server.  Yuck!

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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