Hi: This seems to work:
mykey <- list(space = 'top', columns = 4, text = list(as.character(unique(src$s)), col = colors), points = list(pch = 1, col = colors) ) xyplot(v~t, groups=s, type='o', data=src, col=colors, key = mykey) HTH, Dennis On Fri, Feb 11, 2011 at 7:56 AM, John Smith <zmr...@gmail.com> wrote: > Hello All, > > I am using the following code to draw a figure. But the legend given buy > auto.key has mismatched colors. Could any one help me? > > I am using R2.12.1 and most current lattice on windows XP. > > Thanks > > John > > library(lattice) > > src <- data.frame(t=rep(c('A','B','C','D'), rep(8,4)), > s=rep(c(8132,8140,8178,8180,8224,8230,8337,8345), 4), > v=c(55.10, 56.00, 206.00, 5.86, 164.00, 102.00, 171.00, > 280.00, 236.00, > 91.10, 238.00, 102.00, 59.30, 227.00, 280.00, 316.00, > 205.00, 120.00, > 273.00, 98.80, 167.00, 104.00, 155.00, 370.00, 215.00, > 97.60, 133.00, > 135.00, 48.60, 135.00, 77.10, 91.90)) > colors <- rgb(c(228, 55, 77, 152, 255, 255, 166, 247), > c(26, 126, 175, 78, 127, 255, 86, 129), > c(28, 184, 74, 163, 0, 51, 40, 191), maxColorValue=255) > xyplot(v~t, groups=s, type='o', data=src, col=colors, auto.key = > list(points=TRUE, columns = 4, col=colors)) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org 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. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.