[R] lattice different colors in different areas
William Deese
williamdeese at gmail.com
Sun Apr 5 21:19:33 CEST 2009
In making grid graphs, one can make the background semi-transparent
with a line like
grid.rect(gp=gpar(lty=0, fill=rgb(.5, .5, 0,. 25)))
and then make the area where points and lines are plotted white with lines like
pushViewport(plotViewport(c(5,4,3,1)))
pushViewport(dataViewport(year, m, name="plotRegion"))
grid.rect(gp=gpar(fill="white"))
(The area where the labels, title, legend, etc. are remains semi-transparent.)
I need to use the features of lattice for some graphs but want to keep
the same color theme. In lattice, the background can be changed with
the lines below, but it makes the entire graph this color.
bsettings=trellis.par.get("background")
bsettings$col=rgb(.5, .5, 0, .25)
trellis.par.set("background", bsettings)
How do I now change just the plot region back to white?
Thanks.
More information about the R-help
mailing list