Hi all,

I have a data frame like this:

DF <- data.frame(x = rnorm(10), y = rnorm(10), gr = rep(1:5, 2))

and I make the following xy-plot:

library(lattice)
xyplot(y ~ x, data = DF, groups = gr, type = "b", col = 1)


Is it possible that the two points that belong to the same group specified by 
DF$gr to have a different color -- that is for each pair of points connected by 
the line, I want one to be black and the other red. I tried:

xyplot(y ~ x, data = DF, groups = gr, type = "b", col = 1:2)


but it doen't work. Is there any solution for this??

Thanks a lot!

Kito

______________________________________________
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.

Reply via email to