Re: [R] Code improvement

2009-10-27 Thread Sebastien Bihorel
Hi Baptisti, Sorry for the late reply. I wanted to thank you for putting me on the right track. I finally got something to work not really by extracting the legend from a xyplot call, but by building my own legend grid.frame and passing it to my low-level function. Understanding Grobs and

[R] Code improvement

2009-10-22 Thread Sebastien Bihorel
Dear R-Users, I would like to have the opinion of the list on the following matter. I have this generic function that creates multiple lattice scatterplots per page based upon different subsets of the same dataset. The use of different line/point colors/symbols in each plot is based upon a

Re: [R] Code improvement

2009-10-22 Thread baptiste auguie
Hi, I don't know if it helps, but looking at the output of xyplot you can extract the legend (a grid.frame) as follows, library(grid) library(lattice) p = xyplot(x~y, group=x,data=data.frame(x=1:10,y=1:10), auto.key=list(space=right)) legend = with(p$legend$right,