[R] lattice multi-panel layout

efx efisio.solazzo at jrc.ec.europa.eu
Thu Oct 3 15:25:08 CEST 2013


Dear,
I seem to be unable to work out a solution for multi-panel layout using
xyplot. I have tried with layout, grid.layout (latticeExtra), but
unsuccessfully. I can produce all plots individually, but just can't figure
out how to put them all in the same panel! Here is a piece of the code. 

vlayout <- grid.layout(2,3,widths=unit(2,"inches"), heights=unit(1.5,
"inches")) 

lapply(seq(vh), function(i) {
                 for (k in 1:num_bins){
                 indexx <- which(vh[[i]]$dist<= (k*radius/num_bins) &
vh[[i]]$dist> ((k-1)*radius/num_bins))
                 bin_avg[k]<-mean(vh[[i]]$gamma[indexx])      } 
              
  plott[[i]] <- xyplot(   bin_avg ~ dist , type=("p"),  layout= vlayout) 
) } )

 - If I use grid.layout I got the error: "Error in panel.layout[1] *
panel.layout[2] : 
  non-numeric argument to binary operator"
 - If set just layout as c(2,3) all plots are drawn in the bottom left of
the panel!!!
 - If layout is not set at all, all plots are produced in different pages.

I would be grateful if you could help me out.
Regards





--
View this message in context: http://r.789695.n4.nabble.com/lattice-multi-panel-layout-tp4677500.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list