[R] placing rectangle behind plot

Gabor Grothendieck ggrothendieck at gmail.com
Sun Jul 30 05:19:32 CEST 2006


The reason I explicitly specified in the problem that the rectangle should
not be drawn first is that the xyplot is issued as part of a
larger routine that I don't want to modify.

On 7/29/06, Sebastian P. Luque <spluque at gmail.com> wrote:
> Hi Gabor,
>
>
> On Sat, 29 Jul 2006 17:20:29 -0400,
> "Gabor Grothendieck" <ggrothendieck at gmail.com> wrote:
>
> > 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?
>
> If you only need to draw the rectangle behind the points, why not
> 'panel.polygon' before 'panel.xyplot'?
>
>
> xyplot(x ~ x | gl(2, 1), layout=1:2,
>       panel=function(x, y, ...) {
>           panel.polygon(c(3, 3, 8, 8), c(0, 12, 12, 0), col=2)
>           panel.xyplot(x, y, ...)
>       })
>
>
> Cheers,
>
> --
> Seb
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list