Hi List, Am trying to customize a legend in trellis: Draws 2x5 lines in 5 colors and 2 linetypes. I would like to add two more items to the legend showing the key for the line types above the colored legend.
Any suggestions welcome - thanks Herry ############################# #Following example code: library(gregmisc) trellis.device(bg="white") i1=0 i2=-1.89767506 i3=-1.17087085 i4=-0.09853587 i5=0.87486320 a1=1.9106842 a2=0.7518519 x1<-seq(0,7, by=0.01) y1<-inv.logit(a1+a2*(x1)+i1) y2<-inv.logit(a1+a2*(x1)+i2) y3<-inv.logit(a1+a2*(x1)+i3) y4<-inv.logit(a1+a2*(x1)+i4) y5<-inv.logit(a1+a2*(x1)+i5) z1<-inv.logit(a2*(x1)+i1) z2<-inv.logit(a2*(x1)+i2) z3<-inv.logit(a2*(x1)+i3) z4<-inv.logit(a2*(x1)+i4) z5<-inv.logit(a2*(x1)+i5) as.data.frame(cbind(y1,y2,y3,y4,y5,z1,z2,z3,z4,z5))->tmp leg.txt<-c("Rating 1","Rating 2","Rating 3","Rating 4","Rating 5") colo<-rep(c("black","red","darkgreen","navyblue","rosybrown"),2) plot4<-xyplot(y1+y2+y3+y4+y5+z1+z2+z3+z4+z5~x1, cex=2, xlab="number x", ylab="Probability", bg="white", xlim=c(0,7), ylim=c(0,1), type="l", allow.multiple=TRUE, data=tmp, panel=function(x,y,subscripts,...){ for(i in 1:5){ panel.xyplot(x1,tmp[,i],col=colo[i],lwd=2,lty=1,...) } for(i in 6:10){ panel.xyplot(x1,tmp[,i],col=colo[i],lwd=2,lty=2,...) } } ) update(plot4, key = list(corner=c(0,1), x=0.65, y=0.35, points=list(c(1:5),col=colo[1:5],pch=19), text=list(leg.txt), ) ) ######------- Not working part------------------XXXXXXXXXXXXXXXXXXXXXXX update(plot4, key = list(corner=c(0,1), x=0.65, y=0.35, lines=list(c(1:2),col="black",lwd=1,lty=c(1:2)), text=list(c("category 1","category 2")), points=list(c(1:5),col=colo[1:5],pch=19), text=list(leg.txt), ) ) -------------------------------------------- Alexander Herr - Herry Northern Futures Davies Laboratory PMB, Aitkenvale, QLD 4814 Phone (07) 4753 8510 Fax (07) 4753 8650 Home: http://batcall.csu.edu.au/~aherr Webadmin ABS: http://ausbats.org.au Sustainable Ecosystems: http://www.cse.csiro.au/ -------------------------------------------- [[alternative HTML version deleted]] ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help