[R] xyplot() and controlling panel.polygon()
Sundar Dorai-Raj
sundar.dorai-raj at pdf.com
Thu Apr 26 19:05:43 CEST 2007
Michael Kubovy said the following on 4/26/2007 7:20 AM:
> Dear R-helpers,
>
> How do I tell panel.polygon what greoup and panel it applies to whithin
> xyplot(y ~ x | c, groups = g
> panel = function(x, y, groups, ...){
> panel.polygon(x = xpol[c, g], y = ypol[c, g], default.units
> = 'native')
> panel.xYplot(x, y, groups, ...)
> llines(x = c(1, 6), y = c(-24.283333, 35.941667), lwd = 2, lty =
> 3, col = 4)
> }
> x[c, g] and y[c, g] describe the polygon I want plotted for group g
> in panel c.
> _____________________________
> Professor Michael Kubovy
> University of Virginia
> Department of Psychology
> USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
> Parcels: Room 102 Gilmer Hall
> McCormick Road Charlottesville, VA 22903
> Office: B011 +1-434-982-4729
> Lab: B019 +1-434-982-4751
> Fax: +1-434-982-4766
> WWW: http://www.people.virginia.edu/~mk9y/
>
> ______________________________________________
> 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.
I believe you can just do:
panel = function(x, y, subscripts, groups, ...) {
## note addition of subscripts to arguments
panel.superpose(xpol, ypol, subscripts, groups,
panel.groups = "panel.polygon",
default.units = "native", ...)
panel.xYplot(x, y, subscripts, groups, ...)
llines(x = c(1, 6), y = c(-24.283333, 35.941667),
lwd = 2, lty = 3, col = 4)
}
Also, it would be easier to provide tested answers if you gave a
reproducible example.
HTH,
--sundar
More information about the R-help
mailing list