[R] Panels order in lattice graphs

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu May 5 11:44:14 CEST 2011


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



More information about the R-help mailing list