fig_scale: Scales the Dimensions of Multiple Figs

View source: R/fig.R

fig_scaleR Documentation

Scales the Dimensions of Multiple Figs

Description

Finds the dimensions of the largest figs, and adds a border of the given colour around the other figs, to ensure they are all of the same dimensions and scale properly when displayed on in a patchwork together.

Usage

fig_scale(..., border_colour = "transparent")

Arguments

...

Multiple figs created with fig().

border_colour

Colour of the border to be added around the smaller figs.

Value

A list of figs which have been resized, which can be input directly into fig_wrap() or patchwork::wrap_plots().

Examples

library(figpatch)
fl <- image_path <- system.file("extdata",
  package = "figpatch",
  mustWork = TRUE
) %>%
  list.files(
    pattern = "png",
    full.names = TRUE
  )

# without scaling
fl %>%
  lapply(fig) %>%
  fig_wrap(ncol = 2)

# with scaling
fl %>%
  lapply(fig) %>%
  fig_scale() %>%
  fig_wrap(ncol = 2)

figpatch documentation built on May 3, 2022, 9:07 a.m.