Dear r-helpers,
In an xyplot I have
xyplot(y ~ x | c, groups = g,
scales = list(
x = list(
at = v1,
labels = c('A', 'B', 'C', 'D'),
rot = 45
)
)
)
g consists of two groups. How do I define a different set of x ticks
and labels for the second panel? I'm looking for something like
xyplot(y ~ x | c, groups = g,
scales = list(
x = list(ifelse(g == g1, {
at = v1,
labels = c('A', 'B', 'C', 'D'),
rot = 45},
{at = v2,
labels = c('E', 'F' 'G"),
rot = 45}
)
)
)
_____________________________
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/
Richard M. Heiberger
2007-May-09 02:10 UTC
[R] Separate x-axis ticks for panels in xyplot()?
This will get you started.
Rich
tmp <- data.frame(y=rnorm(20), x=rnorm(20),
c=factor(rep(letters[1:5], 4)),
g=factor(rep(1:2, each=10)))
v1 <- seq(-1.5, 0, .5)
v2 <- 0:2
xyplot(y ~ x | c, groups = g, data=tmp,
scales = list(x = list(
relation="sliced",
at = rep(list(v1, v2), length=5),
labels = rep(list(
c('A', 'B', 'C', 'D'),
c('E', 'F', 'G')), length=5),
rot = 45)))