I am try to create a plot using xyplot(). I created a function panel.fun() wich generate segment, but I need use two columns from dataset2. 
   
  library(lattice)
  panel.fun <- function(x, y, minx, maxx, miny, maxy)
{
  panel.xyplot(x,y)
 
  # since I don't know how to call dataset2 inside panel.fun(), so I hardcoded the data into function  
  seq1 <-c()
  seq2 <-c()

  plotcols=rainbow(length(seq1))
    for(i in 1:length(seq1))
  {
  a <- seq1[i]
  b <- seq2[i]
  panel.segments(a,miny-rangey,a, maxy+rangey, col= plotcols[i],lty=4, lwd=2)
  panel.segments(b,miny-rangey,b, maxy+rangey, col= plotcols[i],lty=4, lwd=2)
    }
}
   
  # after create panel.fun, I call xyplot()
  xyplot(a ~ b , data=dataset1, auto.key=TRUE, panel=function(x,y, minx, maxx, miny, maxy, seq){
 panel.fun(x,y, min(na.omit(x)), max(na.omit(x)),min(na.omit(y)),max(na.omit(y)))
  })
   
   
  Does anyone know how to solve this probelm?

       
---------------------------------
[[elided Yahoo spam]]
	[[alternative HTML version deleted]]

