Hi all, In lattice graphs, panels are drawn from left to right and bottom to top. The flag "as.table=TRUE" changes to left to right and top to bottom. Is there any way to change to first top to bottom and then left to right? didn?t find anything neither in Help pages nor Lattice book. Cristina -- ------------------------------------------ Cristina Silva INRB/L-IPIMAR Unidade de Recursos Marinhos e Sustentabilidade Av. de Bras?lia, 1449-006 Lisboa Portugal Tel.: 351 21 3027096 Fax: 351 21 3015948 csilva at ipimar.pt
Hi Cristina, you can probably hack your own solution using the index.cond argument. Cheers Andrew On Wed, May 04, 2011 at 04:50:53PM +0100, Cristina Silva wrote:> Hi all, > > In lattice graphs, panels are drawn from left to right and bottom to > top. The flag "as.table=TRUE" changes to left to right and top to > bottom. Is there any way to change to first top to bottom and then left > to right? didn?t find anything neither in Help pages nor Lattice book. > > Cristina > > -- > ------------------------------------------ > Cristina Silva > INRB/L-IPIMAR > Unidade de Recursos Marinhos e Sustentabilidade > Av. de Bras?lia, 1449-006 Lisboa > Portugal > Tel.: 351 21 3027096 > Fax: 351 21 3015948 > csilva at ipimar.pt > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Andrew Robinson Program Manager, ACERA Department of Mathematics and Statistics Tel: +61-3-8344-6410 University of Melbourne, VIC 3010 Australia (prefer email) http://www.ms.unimelb.edu.au/~andrewpr Fax: +61-3-8344-4599 http://www.acera.unimelb.edu.au/ Forest Analytics with R (Springer, 2011) http://www.ms.unimelb.edu.au/FAwR/ Introduction to Scientific Programming and Simulation using R (CRC, 2009): http://www.ms.unimelb.edu.au/spuRs/
May 04, 2011; 5:50pm Cristina Silva wrote:> In lattice graphs, panels are drawn from left to right and bottom to > top. The flag "as.table=TRUE" changes to left to right and top to > bottom. Is there any way to change to first top to bottom and then left > to right? didn?t find anything neither in Help pages nor Lattice book.Cristina, You have not fully explained your problem. An approach I use for difficult-to-get-right arrangements is the following. Say you have two conditioning variables (13 panels in all) and you want to place the last panel on the top row in the first position on the bottom row, but leave everything else the same, then easiest is the following: ## Note: T.xyplot$index.cond is a __list__, so you need to use [[ T.xyplot <- xyplot(Prop ~ OM | interaction(Treatment, Aspect, drop = TRUE), data = myDat) print(T.xyplot)> T.xyplot$index.cond[[1]] [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 T.xyplot$index.cond[[1]] <- c(13, 1:12) print(T.xyplot) Hope this helps to solve your problem. Regards, Mark. ----- Mark Difford (Ph.D.) Research Associate Botany Department Nelson Mandela Metropolitan University Port Elizabeth, South Africa -- View this message in context: http://r.789695.n4.nabble.com/Panels-order-in-lattice-graphs-tp3496022p3497691.html Sent from the R help mailing list archive at Nabble.com.
On Wed, May 4, 2011 at 9:20 PM, Cristina Silva <csilva at ipimar.pt> wrote:> Hi all, > > In lattice graphs, panels are drawn from left to right and bottom to top. > The flag "as.table=TRUE" changes to left to right and top to bottom. Is > there any way to change to first top to bottom and then left to right? > didn?t find anything neither in Help pages nor Lattice book.See ?packet.panel.default. For example, p <- xyplot(mpg ~ disp | factor(carb), mtcars, as.table = TRUE) print(p, packet.panel = packet.panel.default) my.packet.panel <- function(layout, condlevels, page, row, column, ...) { tlayout <- layout[c(2, 1, 3)] # switch row and column print(packet.panel.default(tlayout, condlevels, page = page, row = column, column = row, ...)) } print(p, packet.panel = my.packet.panel) -Deepayan
Thank you very much. Cristina On 05/05/2011 10:44, Deepayan Sarkar wrote:> On Wed, May 4, 2011 at 9:20 PM, Cristina Silva<csilva at ipimar.pt> wrote: >> Hi all, >> >> In lattice graphs, panels are drawn from left to right and bottom to top. >> The flag "as.table=TRUE" changes to left to right and top to bottom. Is >> there any way to change to first top to bottom and then left to right? >> didn?t find anything neither in Help pages nor Lattice book. > See ?packet.panel.default. For example, > > > p<- xyplot(mpg ~ disp | factor(carb), mtcars, as.table = TRUE) > > print(p, packet.panel = packet.panel.default) > > my.packet.panel<- > function(layout, condlevels, page, row, column, ...) > { > tlayout<- layout[c(2, 1, 3)] # switch row and column > print(packet.panel.default(tlayout, condlevels, page = page, > row = column, column = row, ...)) > } > > print(p, packet.panel = my.packet.panel) > > > -Deepayan >-- ------------------------------------------ Cristina Silva INRB/L-IPIMAR Unidade de Recursos Marinhos e Sustentabilidade Av. de Bras?lia, 1449-006 Lisboa Portugal Tel.: 351 21 3027096 Fax: 351 21 3015948 csilva at ipimar.pt
Thanks to all that reply to my post. The best solution that answers entirely to my question and can be used as a general function and not case by case is the one sent by the package author. Many thanks to everybody. It was helpful. Cristina On 05/05/2011 10:44, Deepayan Sarkar wrote:> On Wed, May 4, 2011 at 9:20 PM, Cristina Silva<csilva at ipimar.pt> wrote: >> Hi all, >> >> In lattice graphs, panels are drawn from left to right and bottom to top. >> The flag "as.table=TRUE" changes to left to right and top to bottom. Is >> there any way to change to first top to bottom and then left to right? >> didn?t find anything neither in Help pages nor Lattice book. > See ?packet.panel.default. For example, > > > p<- xyplot(mpg ~ disp | factor(carb), mtcars, as.table = TRUE) > > print(p, packet.panel = packet.panel.default) > > my.packet.panel<- > function(layout, condlevels, page, row, column, ...) > { > tlayout<- layout[c(2, 1, 3)] # switch row and column > print(packet.panel.default(tlayout, condlevels, page = page, > row = column, column = row, ...)) > } > > print(p, packet.panel = my.packet.panel) > > > -Deepayan >-- ------------------------------------------ Cristina Silva INRB/L-IPIMAR Unidade de Recursos Marinhos e Sustentabilidade Av. de Bras?lia, 1449-006 Lisboa Portugal Tel.: 351 21 3027096 Fax: 351 21 3015948 csilva at ipimar.pt