Arrange grobs as a new grob with n*m (rows*cols)
layout.
Arguments
- ...
grobs.
- grobs
list of grobs.
- ncol
number of columns in layout.
- nrow
number of rows in layout.
- padding_ht
unit of length 1, vertical space between each grob.
- padding_wt
unit of length 1, horizontal space between each grob.
- vp
a
viewport
object (orNULL
).- gp
A
gpar
object.- name
a character identifier for the grob.
Examples
library(grid)
# Internal function - arrange_grobs
if (FALSE) {
num <- lapply(1:9, textGrob)
grid::grid.newpage()
grid.draw(arrange_grobs(grobs = num, ncol = 2))
showViewport()
g1 <- circleGrob(gp = gpar(col = "blue"))
g2 <- circleGrob(gp = gpar(col = "red"))
g3 <- textGrob("TEST TEXT")
grid::grid.newpage()
grid.draw(arrange_grobs(g1, g2, g3, nrow = 2))
showViewport()
grid::grid.newpage()
grid.draw(arrange_grobs(g1, g2, g3, ncol = 3))
grid::grid.newpage()
grid::pushViewport(grid::viewport(layout = grid::grid.layout(1, 2)))
vp1 <- grid::viewport(layout.pos.row = 1, layout.pos.col = 2)
grid.draw(arrange_grobs(g1, g2, g3, ncol = 2, vp = vp1))
showViewport()
}