[R] gray background in png

Deepayan Sarkar deepayan at stat.wisc.edu
Sun Jul 18 19:52:02 CEST 2004


On Sunday 18 July 2004 12:29, Andrew Criswell wrote:
> It also seems to work with two lines of code crossed out.
>
> library(lattice)
> z <- expand.grid(A = LETTERS[1:8], B = letters[1:6], x = 1, y = 1)
>
> trellis.device(png, file = "test%02d.png")
> # par(bg = "white")
> # lset(col.whitebg())
> lset(list(background = list(col = "white")))
> xyplot(y ~ x | A * B, data = z, layout = c(4, 6))
> dev.off()

Yes, that's because after trellis.device() is called, par("bg") is 
already white, which makes the first commented line redundant. However, 
it won't 'work' if you want to replace white by another color.

Moreover, I would consider this bad usage. The default color scheme for 
png is designed for a gray background. What you have done (by 
commenting the second line) is to change the background to white while 
keeping everything else unchanged. This technically gives you the 
desired objective of a white background, but with very light colors for 
the points.

Deepayan




More information about the R-help mailing list