Hi, I would like to put a number to each of the plotted curves in each panel. The problem is that there are different numbers of curves in different panels, so as you can see from the code below, I could put the correct numbers to the curves in the first panel, but for the second panel, both location and number of labels are incorrect (I would like to have "(1)" at location x=3.5, y=211 and of course no label "(2)" in the second panel). What is the correct way to solve this? I have a vector where the i-th entry specifies the number of curves in panel i, so I somehow have to bring this vector into play...
Thanks very much in advance. Marius library(lattice) column1=c(1,1,1,1,1,1,2,2) column2=c(1,1,1,2,2,2,1,1) column3=c(1,2,3,1,2,3,4,5) column4=c(111,112,113,121,122,123,211,212) dataframe=data.frame (panelnumber=column1,curvenumber=column2,x=column3,y=column4) xyplot(dataframe[,4]~dataframe[,3]|dataframe[, 1],type="l",lty=1,groups=dataframe[,2],layout=c(2,1),aspect=1, panel=function(...){ panel.xyplot(...) panel.text(3.4,113,label="(1)") panel.text(3.4,123,label="(2)") } ) ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.