[R] xyplot() and controlling panel.polygon()
Michael Kubovy
kubovy at virginia.edu
Fri Apr 27 20:09:12 CEST 2007
Hi Deepayan,
Thanks for your advice. This is moving along, however:
The following is drawing the same polygons in each panel. I'm trying
to get a different polygon (confidence band) for each group in each
panel. That's why I thought I would need to pass groups and
subscripts to the panel.groups
est <- c(1:4, 3:6, 7, 9, 11, 13, 12, 15, 18, 21)
cond <- rep(c('a','b'), each = 8)
grp <- rep(c('I', 'II'), each = 4, 2)
x <- rep(c(.5, .7, .9, 1.1), 4)
upper <- est + 1
lower = est - 1
data <- data.frame(est = est, x = x, cond = cond, grp = grp, upper =
upper, lower = lower)
my.panel.polygon <- function(..., font, fontface)
{
panel.polygon(...)
}
xyplot(est ~ x | cond, group = grp, data = data, type = 'b',
panel = function(x, y, ...){
panel.superpose(c(x, rev(x)), c(upper, rev(lower)),
panel.groups = 'my.panel.polygon', default.units =
'native', ...)
panel.xyplot(x, y, ...)
}
)
It's pretty clear that panel.superpose is not getting its x and y
values after they are split by group and panel.
_____________________________
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/
More information about the R-help
mailing list