[Rd] grid graphics gpar(fill) argument and jpeg device

Florian Hahne f.hahne at dkfz.de
Thu Dec 8 20:22:11 CET 2005


Hi everybody,
I just notice a strange behaviour of gpar's fill argument when using 
non-postscript devices:
The default of the argument is transparent (according to get.gpar("fill")).
So as expected, the following code draws a nice red rectangle in the 
middle of my X11 or postscript device.

pushViewport(viewport(width=0.5, height=0.5))
grid.rect(gp=gpar(fill="red"))
grid.rect()

However, when plotting on  a jpeg device (or any other pixel device), 
the output of the above code is an empty (=white) rectangle. Obviously 
the second grid.rect() which should produce a transparent rectangle 
turns out to be filled white on the jpeg device. When I set the fill 
argument to NA, the second rectangle is transparent as it is supposed to be.

grid.rect(gp=gpar(fill="red"))
grid.rect(gp=gpar(fill=NA))

Is this a bug or a feature???
I'm using R version 2.2.0 on a SUSE 10.0 linux machine.

Cheers,
Florian



More information about the R-devel mailing list