[R] placing rectangle behind plot
Gabor Grothendieck
ggrothendieck at gmail.com
Sat Jul 29 23:20:29 CEST 2006
I am trying to create a lattice plot and would like to later, i.e. after
the plot is drawn, add a grey rectangle behind a portion of it.
The following works except that the rectrangle is on top of and
obscures a portion of the chart. I also tried adding col = "transparent"
to the gpar list but that did not help -- I am on windows and
perhaps the windows device does not support transparency?
At any rate, how can I place the rectangle behind the plotted
points without drawing the rectangle first?
library(lattice)
library(grid)
trellis.unfocus()
x <- 1:10
xyplot(x ~ x | gl(2,1), layout = 1:2)
trellis.focus("panel", 1, 1)
grid.rect(w = .5, gp = gpar(fill = "light grey"))
trellis.unfocus()
More information about the R-help
mailing list