> I'm trying to plot graphs using lattice with this script : > > xyplot(Y ~ X | factmod, > panel = function(x, y) { > panel.grid(h=-1, v=-1, col="gray") > panel.xyplot(x, y, type="p", pch=20) > panel.points(50,Idata, data=devdata, col="red") -----> > this doesn't work > }, > xlab="X", ylab="Y") > > factmod is a factor with 18 labels corresponding to the 18 names of my > devices. > devdata is a data.frame of 2 columns and 18 rows : name of the devices / > value of Idata for each device > For example (smaller one): > devdata<-data.frame(c("a","b","c","d"), c(1,5,9,7)) > > And I would like to add the point (50, Idata) per graph that is > points(50,1) on the first graph > points(50,5) on the second graph, ... > > At the moment, it plots all the points on every graph (or with another > command, only (50,Idata[1]) on all the graphs).
You can use panel.number() or packet.number to specify code specific to different panels, e.g. extrapoints <- seq(25,50,5) panelfn <- function(...) { panel.xyplot(...) panel.points(1, extrapoints[panel.number()], col="red", pch=15) } xyplot(yield~year|site, data=barley, panel=panelfn) Regards, Richie. Mathematical Sciences Unit HSL ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} ______________________________________________ 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.