It is certainly possible. I can think of three ways of doing it, as
illustrated below.
## create a list of three grobs to illustrate the placement
foo <- function(.label) gTree(children=gList(rectGrob(), textGrob(.label)))
g <- lapply(c("this is", "split", "in 3"), foo)
## lazy approach: use grid.arrange twice (arrange two grobs in a row,
## then grid.arrange the result with the last grob)
library(gridExtra)
gg <- arrangeGrob(arrangeGrob(g[[1]], g[[2]], ncol=2), g[[3]],
heights=unit(c(2,.5),c("null","null")))
## result:
## grid.draw(gg)
## second technique, split the page in 4, and specify that you want to use two
## regions when drawing
Layout = grid.layout(nrow=2,ncol=2,heights = unit(c(2,.5),c("null","null")))
## last technique, a first layout split in rows
## then push a second split in columns
Layout2 = grid.layout(nrow=2,ncol=1,heights = unit(c(2,.5),c("null","null")))
Layout3 = grid.layout(nrow=1,ncol=2)
grid.newpage()
## push the 2x2 layout
pushViewport(viewport(layout=Layout))
## draw in the first quadrant
pushViewport(viewport(layout.pos.row=1, layout.pos.col=1))
grid.draw(gg)
upViewport()
## push the Layout2
pushViewport(viewport(layout=Layout2, layout.pos.row=1, layout.pos.col=2))
## then the Layout3
pushViewport(viewport(layout=Layout3, layout.pos.row=1, layout.pos.col=1))
## now draw in the first cell
pushViewport(viewport(layout.pos.row=1, layout.pos.col=1))
grid.draw(g[[1]])
upViewport()
## second cell
pushViewport(viewport(layout.pos.row=1, layout.pos.col=2))
grid.draw(g[[2]])
upViewport()
upViewport()
## last cell
pushViewport(viewport(layout.pos.row=2, layout.pos.col=1))
grid.draw(g[[3]])
upViewport()
upViewport()
## finally: drawing fills two cells
pushViewport(viewport(layout.pos.row=2, layout.pos.col=1:2))
grid.text("confused yet? ;)")
upViewport()
HTH,
baptiste
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
I forgot to mention it, grid.arrange() and arrangeGrob() are in
version 0.6.5 of gridExtra, available at
http://r-forge.r-project.org/R/?group_id=506 . Unfortunately it seems
that the version on CRAN has not yet been updated.
The function used to be called arrange() but the name was clashing
with a new plyr function.
Note that the other two techniques are independent of this package
(just replace gg by whatever grob to run it).
baptiste
The 'R graphics' book by Paul Murrell is the authoritative document, I think.
baptiste