[R] Transparency and trellis device

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed Aug 5 19:16:54 CEST 2009


On 8/5/09, pomchip at free.fr <pomchip at free.fr> wrote:
> Hi Deepayan,
>
>  Thank for you reply.
>  I am a little bit confused now. In the one hand, the trellis.device function has lost his bg argument as explained in the Note section of ?trellis.device, but the background info provided by a theme does not seem to impact the background of the device. In the other hand, png has a bg argument that works great but no "theme" capabilities as far as I could see.
>
>  Do you see a way to reconcile both sides of the problem?

There's no conflict. The "bg" argument of png() (and most other
devices) is a "canvas color" that is handled by the device driver. The
lattice "background" setting controls a background rectangle plotted
by lattice:

png("foo.png", bg = "transparent")
xyplot(1 ~ 1, par.settings = list(background = list(col = "yellow")))
dev.off()

Obviously, plotting a transparent rectangle over a white canvas (which
you were effectively doing) will not make the canvas transparent.

-Deepayan




More information about the R-help mailing list