grid_add_layout() draws images to a layout in grid.
Arguments
- images
A named list of images with all the names in the
namecolumn of thelayoutargument. Currently supports raster objects supported bybittermelonand grid grob objects.- ...
Ignored for now.
- layout
Either a layout preset name in
layout_names()or a data frame with layout data (as returned bylayout_grid()).
See also
piecepackr::pmap_piece() to draw pieces to a layout represented by a piecepackr::pp_cfg() object.
Examples
if (requireNamespace("bittermelon", quietly = TRUE)) {
crops <- bittermelon::farming_crops_16x16()$corn
layout <- data.frame(
name = names(crops),
x = 0.1 + rep(c(1, 3, 5), 2),
y = 0.1 + rep(c(3, 1), each = 3),
width = 2,
height = 2,
angle = 0
)
grid::grid.newpage()
grid_add_layout(crops, layout = layout)
grid_add_rects(layout = layout, gp = grid::gpar(lwd = 4))
}