[R] auto.key = TRUE in xyplot() draws max. 7 groups
Deepayan Sarkar
deepayan at stat.wisc.edu
Mon Oct 6 19:27:44 CEST 2003
On Monday 06 October 2003 03:19, Edzer J. Pebesma wrote:
> In the example below:
>
> library(lattice)
> n = 100
> a = rnorm(n)
> b = rnorm(n)
> c = sample(c(1:7), n, repl=TRUE)
> xyplot(a ~ b, groups = c, auto.key = TRUE)
> c = sample(c(1:8), n, repl=TRUE)
> xyplot(a ~ b, groups = c, auto.key = TRUE)
>
> a key is drawn for the first, but not for the
> second graph. I suppose it has to do with the
> number of groups. If not a bug, maybe
> this should go into the documentation?
Definitely a bug (in Rows). If you are using R 1.7.1, redefining Rows as
follows should fix the problem.
Rows <- function (x, which)
{
for (i in seq(along = x)) x[[i]] <-
rep(x[[i]], length = max(which, length(which)))[which]
x
}
Deepayan
More information about the R-help
mailing list