[R] "strange" behavior of panel.abline inside a for-loop
    Marius Hofert 
    m_hofert at web.de
       
    Tue Feb  8 12:36:38 CET 2011
    
    
  
Dear expeRts,
I would like to create a list of lattice xyplots. Here is the minimal example:
library(lattice)
plot.list <- vector("list", 10)
for(i in 1:10){
    plot.list[[i]] <- xyplot(i~i, type="p", xlim=c(0,11), panel=function(...){
	panel.xyplot(...)
	panel.abline(v=i)
    })
}
plot.list[[3]]
As  you can see, the vertical line is *always* printed at x=10 [and not at x=i]. Why?
Cheers,
Marius
    
    
More information about the R-help
mailing list