I'd like to draw a lattice plot with groups. The groups (the grouping 
condition, fns) are successfully marked with separate symbols, using the 
following code:
xyplot(T~A|speaker,groups=fns,pch=1:3,key=list(space="right",points=list(pch=1:3)),type=c("g","p","r"))
Here's a hard part. This draws regression lines for each group in each panel 
(there are three groups, so three regression lines show up in each panel). But 
I want to have only one global regression line for all groups together, still 
maintaining separate symbols for each group. 
I don't want to have individual regression lines for each group.
I tried many things, with various panel functions, but I've never succeeded. 
Could any expert help with this? I'd appreciate it greatly. The closest I could 
find was something like the following, which didn't work for me - anyways, it 
is supposed to draw by-group regression lines as well as the global one. So 
this is not exactly I need. 
xyplot(T~A|speaker,data=spk0,layout=c(4,5),type='p',groups=fns),
panel=function(x,y){
 panel.superpose(x,y)
 panel.abline(lm(y~x))}),
panel.groups=function(x,y,lty){
 panel.xyplot(x,y,lty=lty)
 panel.abline(lm(y~x),lty=3)})
Thanks so much !!! 

        [[alternative HTML version deleted]]

______________________________________________
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