Change the colour of lines in the xyplot?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Change the colour of lines in the xyplot?

Zhang Jian
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))

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Change the colour of lines in the xyplot?

Chuck Cleland
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]]
>
> ______________________________________________
> [hidden email] 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

______________________________________________
[hidden email] 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.