[R] Changing colors and symbols in lattice

John Poulsen jpoulsen at zoo.ufl.edu
Sat Nov 1 19:14:25 CET 2008


Hello,

I have made a plot using xYplot, but am having trouble with some final 
touching up details.  I would appreciate your help...

The below code results in a plot of 4 species, with the species being 
the same color.  So, the first three points are blue, the second three 
are purple, etc...  The first thing I would like to do is make the 
points alternate colors (to represent species in sites), so that the 
points in each panel are blue, red, green, blue, red green.

Also, how can I add a label on the x-axis for each species, so that in 
the first panel "A" and "B" are below the first and second groups of 
three points.

y=rnorm(12, 15, 0.5)
sy=rnorm(12,0.2,.01)
x=rep(c(1:6), 2)
spp=rep(c(1,2,3,4),each=3)
gld=rep(c(1,2),each=6)


xYplot(Cbind(y, y-sy, y+sy)~x|gld, groups=spp)


Thanks,
John



More information about the R-help mailing list