[R] xyplot w/ panel.lmline "solution"
eesteves@ualg.pt
eesteves at ualg.pt
Thu Mar 17 11:30:04 CET 2005
Dear Sebastian Luque (and All R Users)
With the following code I managed to plot different characters and regression
lines for panels 2 ("Day of year 101") and >4 ("Days of year" 151, 157 and
172):
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.number) {
if(panel.number==2){
panel.xyplot(x, y,col=1)
panel.xyplot(x[6:11],y[6:11],pch=16,col=1)
panel.lmline(x[6:11],y[6:11])}
else{
panel.xyplot(x, y,col=1)
panel.xyplot(x[2:11],y[2:11],pch=16,col=1)
panel.lmline(x[2:11],y[2:11])}
if(panel.number>4){
panel.xyplot(x, y,col=1)
panel.xyplot(x[14:20],y[14:20],pch=16,col=2)
panel.lmline(x[14:20],y[14:20],lty=2)}
})
The resulting plot is herein (attached MortalityRates.pdf file).
Thanks to you all, Eduardo Esteves
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MortalityRates.pdf
Type: application/pdf
Size: 32485 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20050317/731f9c46/MortalityRates.pdf
More information about the R-help
mailing list