Skip to contents

grid_add_layout() draws images to a layout in grid.

Usage

grid_add_layout(images, ..., layout = "poker_3x3")

Arguments

images

A named list of images with all the names in the name column of the layout argument. Currently supports raster objects supported by bittermelon and grid grob objects.

...

Ignored for now.

layout

Either a layout preset name in layout_names() or a data frame with layout data (as returned by layout_grid()).

Value

NULL invisibly. As a side effect draws images to the active graphics device.

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))
}