I've been attempting to export a graphics file of my lattice plots and no matter what color I use for the bg= argument in the bmp/jpeg/png function, the background is grey. bmp(filename = "c:/my_paper/resids.bmp", width=1024, height=1024, pointsize=10, bg="transparent") # these are lattice plots. plot them in a 3x2 matrix print( hgqqplot, position=c(0.0, 0.66, 0.5, 1.0 ), more=TRUE ) print( hgplot, position=c(0.5, 0.66, 1.0, 1.0 ), more=TRUE ) print( dgqqplot, position=c(0.0, 0.33, 0.5, 0.66 ), more=TRUE ) print( dgplot, position=c(0.5, 0.33, 1.0, 0.66 ), more=TRUE ) print( cwgqqplot, position=c(0.0, 0.0, 0.5, 0.33 ), more=TRUE ) print( cwgplot, position=c(0.5, 0.0, 1.0, 0.33 ), more=FALSE ) dev.off() I've tried white, no argument at all, transparent, etc. and all yield the same results. Is this broken, or am I not using the function correctly. Thanks, Jeff. -- Jeff D. Hamann Forest Informatics, Inc. PO Box 1421 Corvallis, Oregon 97339-1421 phone 541-754-1428 jeff.hamann at forestinformatics.com http://www.forestinformatics.com
Jeff D. Hamann wrote:> I've been attempting to export a graphics file of my lattice plots and no > matter what color I use for the bg= argument in the bmp/jpeg/png function, > the background is grey. > > bmp(filename = "c:/my_paper/resids.bmp", width=1024, height=1024, > pointsize=10, bg="transparent") > > # these are lattice plots. plot them in a 3x2 matrix > print( hgqqplot, position=c(0.0, 0.66, 0.5, 1.0 ), more=TRUE ) > print( hgplot, position=c(0.5, 0.66, 1.0, 1.0 ), more=TRUE ) > print( dgqqplot, position=c(0.0, 0.33, 0.5, 0.66 ), more=TRUE ) > print( dgplot, position=c(0.5, 0.33, 1.0, 0.66 ), more=TRUE ) > print( cwgqqplot, position=c(0.0, 0.0, 0.5, 0.33 ), more=TRUE ) > print( cwgplot, position=c(0.5, 0.0, 1.0, 0.33 ), more=FALSE ) > > dev.off() > > I've tried white, no argument at all, transparent, etc. and all yield the > same results. Is this broken, or am I not using the function correctly. > > Thanks, > Jeff. >I haven't tried it but perhaps you need trellis.device: library(lattice) trellis.device(bmp, filename = "c:/my_paper/resids.bmp", width=1024, height=1024, pointsize=10, bg="transparent") # these are lattice plots. plot them in a 3x2 matrix print( hgqqplot, position=c(0.0, 0.66, 0.5, 1.0 ), more=TRUE ) print( hgplot, position=c(0.5, 0.66, 1.0, 1.0 ), more=TRUE ) print( dgqqplot, position=c(0.0, 0.33, 0.5, 0.66 ), more=TRUE ) print( dgplot, position=c(0.5, 0.33, 1.0, 0.66 ), more=TRUE ) print( cwgqqplot, position=c(0.0, 0.0, 0.5, 0.33 ), more=TRUE ) print( cwgplot, position=c(0.5, 0.0, 1.0, 0.33 ), more=FALSE ) dev.off() --sundar
On Thursday 27 May 2004 17:24, Jeff D. Hamann wrote:> I've been attempting to export a graphics file of my lattice plots > and no matter what color I use for the bg= argument in the > bmp/jpeg/png function, the background is grey. > > bmp(filename = "c:/my_paper/resids.bmp", width=1024, height=1024, > pointsize=10, bg="transparent")This doesn't affect lattice's own settings, which is what's going to be used. You should instead use trellis.device(bmp, filename = "c:/my_paper/resids.bmp", width=1024, height=1024, pointsize=10, # probably useless bg="transparent") or call lset(list(background = list(col = "transparent"))) after the bmp device is opened using bmp() directly. (this works for me with png at least, my installation doesn't seem to have a bmp device) Deepayan