[R] Change the colour of lines in the xyplot?

Chuck Cleland ccleland at optonline.net
Mon Jul 12 11:23:54 CEST 2010


On 7/12/2010 2:52 AM, Jian Zhang wrote:
> I want to add the legend for my figure using "auto.key" in the xyplot function (library(lattice)). But I don't know how to change the colors of the lines in the "legend" part. I tried to add "col=1:8" in the "auto.key", but it changes the colors of the text of my Legend, not the lines. How can I change the colors of the lines?
> 
> xyplot(estimated~year,data=res,type="l",group=sp,
> auto.key= list(points = FALSE, lines=TRUE, corner =c(0.1,0.6),size=5, col=1:8))

xyplot(estimated ~ year, data=res, type="l", group=sp,
par.settings = list(superpose.line=list(col=1:8)),
auto.key=list(points=FALSE, lines=TRUE, corner=c(0.1,0.6), size=5))

> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894



More information about the R-help mailing list