[R] Little graph questions!

Prof Brian D Ripley ripley at stats.ox.ac.uk
Sun Feb 17 18:59:13 CET 2002


On 17 Feb 2002, Peter Dalgaard BSA wrote:

> Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:
>
> > > Works well for me (R-1.4.1, WinNT4; your version / OS?).
> > > You didn't specify a background color with par(bg=...) before?
> >
> > I see it on Linux, although my R versions are slightly old on this
> > particular machine. I'll rebuild the development version and see if it
> > disappeared, but I don't think we touched this since 1.4.0?
>
> Still there. Minimal reproducing example is
>
> plot(1)
> dev.copy(png)
> dev.off(3)
>
> and then look at the Rplot.png with ee or whatever. Doesn't change
> anything to use bg="whatever" on the dev.copy call, so the problem
> would seem to lie in the extraction of the parameter from the X11
> device.

I get:
auk% identify -verbose Rplot.png
Image: Rplot.png
  type: grayscale
  class: PseudoClass
  colors: 2
    0: (  0,  0,  0)  #000000  black
    1: (254,254,254)  #fefefe  ~white
  signature: 821dc961fc62f41debc97b113046b69c
  matte: False
  runlength packets: 2590 of 230400
  geometry: 480x480
  depth: 8
  filesize: 1701b
  interlace: None
  format: PNG
  compression: Zip

The issue is the X11 device has by default a transparent background (coded
by #fefefe internally), so copying it by dev.copy is *not* a good idea.

par(bg = "white")
plot(1)
dev.copy(png)
dev.off(3)

will do what you intended.  I don't see why you are getting a light green,
though.

I don't know why this is not producing transparent png's: it did once do so
but there were extensive driver changes just before the release of 1.4.0.
I probably need to fix those ....

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