[R] graphics backgrounds from gray to white in png()
ripley at stats.ox.ac.uk
Mon Mar 10 19:23:03 CET 2003
Why are you using lattice for a single plot?
If you use lattice, you should be using trellis.device(), or at least
setting the lattice parameters *after* you open the device. You set the
parameters for a screen device (or whatever you had open before).
On Mon, 10 Mar 2003, Scot W McNary wrote:
> I'm trying to make a png file of a histogram. I would like a white
> background in the final product but end up producing a gray one, despite
> setting what I think are the correct parameters. Suggestions for how to
> properly set a white background would be welcome.
> Thanks in advance,
> # for non-lattice
> > par("bg"="white")
> > par("bg")
>  "white"
> # for lattice
> > trellis.par.get("background")
>  "white"
> # produces gray background in png, but white when plotted in active device
> > png(filename = "c:/windows/temp/test.png", width=480, height=640,
> + pointsize = 10, bg="white")
> > histogram(rnorm(500))
> > dev.off()
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 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help