[R] order the plots using lattice

audrey audrey at ebi.ac.uk
Thu Mar 6 13:00:42 CET 2008


Dear all,

I am running something similar to this short example:

library("lattice")
library("geneplotter")

X=matrix(cbind(1:100,100:1,c(1:50,50:1)),ncol=3)
Y=matrix(cbind(1:100,1:100,1:100),ncol=3)
names=1:3

dummy.df = data.frame(names = factor(names, levels = names),
  x = seq_along(names),
  y = seq_along(names))   

xyplot(y ~ x | names, dummy.df,
      xlim = c(1,100),
      ylim = c(1,100),
       panel = function(x, y, ...) {
         x <- X[,x]
         y <- Y[,y]
         panel.smoothScatter(x, y ,...)
       },       
       layout = c(2, 2, 1),
       strip = function(..., bg) strip.default(..., bg ="#cce6ff"))

In the output, the first plot is represented in the bottom left corner, I would like the plots to be drawn from the top left corner but I cannot find in the Lattice help, the argument to set to do that. I have tried to play with the index.cond but depending on my number of plots to draw, it does not always work properly in an automated script. Does anyone knows a trick to start drawing the plots from the top left corner?

Thanks in advance for your help,
Audrey

PS: sessionInfo()
R version 2.7.0 Under development (unstable) (2008-03-05 r44682) 
x86_64-unknown-linux-gnu 

locale:
LC_CTYPE=en_US.ISO-8859-1;LC_NUMERIC=C;LC_TIME=en_US.ISO-8859-1;LC_COLLATE=en_US.ISO-8859-1;LC_MONETARY=en_US.ISO-8859-1;LC_MESSAGES=en_US.ISO-8859-1;LC_PAPER=en_US.ISO-8859-1;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.ISO-8859-1;LC_IDENTIFICATION=C

attached base packages:
[1] tools     stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] geneplotter_1.17.3 annotate_1.15.0    Biobase_1.17.7     lattice_0.17-6    
[5] fortunes_1.3-3    

loaded via a namespace (and not attached):
[1] AnnotationDbi_0.0.68 DBI_0.2-3            grid_2.7.0          
[4] KernSmooth_2.22-22   RColorBrewer_1.0-1   RSQLite_0.5-4



More information about the R-help mailing list