[R] no transparent background in bmp

Sundar Dorai-Raj sundar.dorai-raj at PDF.COM
Fri May 28 00:56:07 CEST 2004



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




More information about the R-help mailing list