[R] xyplot w/ panel.lmline "solution"

From: <eesteves_at_ualg.pt>
Date: Thu 17 Mar 2005 - 21:30:04 EST


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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Mar 17 21:36:31 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:50 EST