[R] Transparency and trellis device

pomchip at free.fr pomchip at free.fr
Wed Aug 5 19:40:51 CEST 2009

One thing that I did not mention is that my themes contain additional settings (like margin definitions). By looking at the code of trellis.device, it look like the operation of this function can be simplified a device opening followed by a trellis.par.set call. Am I correct?
If so, I think I could replace my trellis.device call by the sequence png("foo.png", bg="transparent") / trellis.par.set(mytheme).


----- Mail Original -----
De: "Deepayan Sarkar" <deepayan.sarkar at gmail.com>
À: pomchip at free.fr
Cc: r-help at stat.math.ethz.ch
Envoyé: Mercredi 5 Août 2009 13h16:54 GMT -05:00 USA/Canada - États de l'Est
Objet: Re: [R] Transparency and trellis device

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")))

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


More information about the R-help mailing list