All,
When specifying colors to xyplot w/ a groups argument, using
auto.key no longer maintains the colors properly. I've searched
the docs and help but haven't found exactly what I need ... I saw
a few examples in the archives involving par.settings but that doesn't
seem to do it. I also saw some people using key instead of auto.key, but
that didn't seem consistent. Is there a quick fix to the example code
below?
cheers,
Dave
dat.ex = data.frame( rep(c(1:6), each=6), c(rnorm(12), rnorm(12, 1),
rnorm(12, 2)), rep(c(1:6), 6),
rep(c("Drug1", "Drug2", "Placebo"), each=12) )
names(dat.ex) = c("patient.no", "outcome", "time", "drug")
## colors in xyplot agree w/ colors in key, colors not specified:
xyplot(outcome ~ time, dat.ex, groups=drug, type=c("g", "smooth"),
auto.key = list(space = "top", text = levels(dat.ex$drug),
points=FALSE, lines=TRUE ) )
## colors in xyplot do NOT agree w/ colors in key when colors changed:
xyplot(outcome ~ time, dat.ex, groups=drug, type=c("g", "smooth"),
auto.key = list(space = "top", text = levels(dat.ex$drug),
points=FALSE, lines=TRUE ),
col = c(1,2,3) )
i.e., the key is still generated w/ the "old" colors.
______________________________________________
[email protected] 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.