[R] xyplot and subscripts
Kito Palaxou
kitopalaxou at yahoo.com
Thu Aug 6 16:27:42 CEST 2009
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
More information about the R-help
mailing list