[R] gray background in png

Andrew Criswell r-stats at arcriswell.com
Sun Jul 18 19:17:54 CEST 2004


Hello:

I was able to get two graphs with white background in JPG format, but 
only the first graph with PNG format (as previously remarked). 
Curiously, I only got the first graph saved (with white background) for 
the PDF format. Code follows...

ANDREW

library(lattice)
z <- expand.grid(A = LETTERS[1:8], B = letters[1:6])
z$x <- z$y <- rep(1, nrow(z))

png(file = "~/tmp/test%02d.png")
lset(theme = col.whitebg())
xyplot(y ~ x | A * B, data = z, layout = c(4, 6))
dev.off()

jpeg(file = "~/tmp/test%02d.jpg")
lset(theme = col.whitebg())
xyplot(y ~ x | A * B, data = z, layout = c(4, 6))
dev.off()

pdf(file = "~/tmp/test%02d.pdf")
lset(theme = col.whitebg())
xyplot(y ~ x | A * B, data = z, layout = c(4, 6))
dev.off()

 > version

platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    1
minor    9.0
year     2004
month    04
day      12
language R




More information about the R-help mailing list