[R] adding a line to a single panel of a lattice plot

Ken Knoblauch knoblauch at lyon.inserm.fr
Mon May 17 08:59:48 CEST 2004


I'm struggling to find a way to add a line (abline, lline or lmline) to
a single panel of a lattice plot.  In one panel, there is an outlier
and I'd like to include a second lmline fit to the data without this
point.  I've looked through nine pages of the archives on lattice
and it wasn't obvious (to me) what additional search keyword to add 
to hone in on this, although I would think that it's an issue that
would have come up before. I've played around with the
groups, subscripts and panel.superpose arguments and looked through
the lattice.par.get list but haven't found the way to do it yet.
Here is the structure of thecommand that I'm working with, 
but with the abline appearing on all (3 in my case) panels:

xyplot(y ~ x | z, data = my.df,
  panel=function(x,y) {
    panel.xyplot(x,y)
    panel.lmline(x,y)
   panel.abline(c(0.25,0.79,lty=2) #would like this only on panel 1
  },
       layout=c(3,1),aspect="x",
       scales=list(cex=1.2),
       xlab=list(label="x"),
       ylab=list(label="y")

Thanks for any help or directions thereto, in advance.

Ken


____________________
Ken Knoblauch
Inserm U 371
Cerveau et Vision
18 avenue du Doyen Lepine
69675 Bron cedex
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: 06 84 10 64 10




More information about the R-help mailing list