Hello,

I would like to display two groups of dots in different colors or style and 
additionnaly a linear regression for all the dots in
panel plots of a Trellis graph.  Actually to get in each panel the equivalent of:

plot(x[mois==3],y[mois==3],col="blue")
points(x[mois==9],y[mois==9],col="red")
abline(lm(y~x), col="green")

"mois" being a grouping variable and ID (see below) the conditioning variable in a 
data.frame of 230 rows

After several really disatreous trials, I have tried the following:

xyplot(y~x|ID,panel=function(x,y){panel.superpose(x,y,subscripts=1:230,groups=mois);panel.abline(lm(y~x),col="green")})

1/ I am not sure to have well understood what  the role of subscripts (with no 
default) is in the function panel.superpose and if
the values passed are appropriate here;

2/ this apparently displays all the points without changes of style between groups 
(neither symbols or colors).

3/ this does not allow changes in color for points display

Can anybody give me a hint on where I am wrong?

Sorry to be probably very clumpsy,

Kind regards,

Patrick Giraudoux

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to