[R] help w/ xyplot and panel.lmline
eesteves@ualg.pt
eesteves at ualg.pt
Tue Mar 15 18:18:50 CET 2005
Dear All,
I'm confortable with xyplot(...) and panel.lmline(...) statements (at least I
thought I did :). I've used the following code to plot the decline in
log-abundance of fish larvae (no.larvae) with age (age.cls, 4 to 27 days-old)
for specific dates of sampling (day, 9 dates). I further plotted data with
different colors and regression lines for ages 5-14 d and 17-23 d in a 7-by-1
layout.
xyplot(log(no.larvae)~age.cls|factor(day),data=mortal,
layout=c(7,1),aspect=5/3,
xlab="Age class (d)",ylab="Ln(Abundance)",ylim=c(-2.5,6.5),xlim=c(0,30),
panel = function(x, y) {
panel.xyplot(x, y, col=1)
panel.xyplot(x[5:14],y[5:14],pch=16,col=1)
panel.lmline(x[5:14],y[5:14])
panel.xyplot(x[17:23],y[17:23],pch=16,col=2)
panel.lmline(x[17:23],y[17:23],lty=2)
})
Is it possible to change the plotted characters and regression lines for two of
the panels (corresponding to dates 101 and 172). For these dates I intend to
use data only for ages 9-14 d instead of 5-14 d as for the remaining.
Thanks in advance,
Eduardo Esteves
More information about the R-help
mailing list