[R] lattice legend colors recycling sooner than expected

alejandro munoz guerinche at gmail.com
Fri Dec 9 18:03:50 CET 2005

dear r-helpers,

it seems the colors in an automatically generated lattice legend
recycle after the 8th color, even when the user has set e.g.
superpose.symbol$col to be longer than 8. the following example will
illustrate what i mean:

z <- data.frame(x=rep(letters[1:15], each=4), y=rnorm(60),
                groups=rep(LETTERS[1:3], 20))
plot(groupedData(y ~ x | groups, data=z))
# symbol colors recycle after every 8 for plot and legend symbols;
# e.g. a, h, and o are cyan.

trellis.par.set(superpose.symbol = list(col=rainbow(15)))
plot(groupedData(y ~ x | groups, data=z))
# each dot in the plot has a different color, but colors in legend
# still recycle every 8 points; e.g. cyan, violet, and blue aren't in legend.

in case this is an nlme issue, i examined the three
plot.XXXGroupedData methods, but could not find any obvious fixes.

is there a simple way of having auto.key "know" how many color entries
it should have?


More information about the R-help mailing list