Richard.Cotton at hsl.gov.uk
2008-May-13 12:02 UTC
[R] add horizontal line "(ABLINE(V=))" to xyplot lattice
> In a lattice plot like this: > > win.graph() > xyplot(tmx~frequ|as.factor(as.numeric(spf)),groups=as.factor(blm), > data=tmx,type="l",pch=16,xlab="frequency (N)",ylab="Area held (ha)", > auto.key=list(blm,points=F,lines=T,title="Blm factor",cex.title=0.7, > cex=0.7,corner=c(1,1)),main="Mangroves target=1573ha",layout=c(2,3)) > > I would like to add a horizontal line to each one of the 5 graphs > with a single value, v=1573Try using a custom panel function, something like: mypanelfn <- function(x,y,...) { panel.xyplot(x=x, y=y, ...) grid.lines(c(0,1), unit(rep(1573, 2), "native") } xyplot(<your params>, panel=mypanelfn) You can also try using llines instead of grid.lines. Regards, Richie. Mathematical Sciences Unit HSL ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential inform...{{dropped:20}}