Skip to contents

Combine list output from plot_spr_inputs() into a multi-panel figure using patchwork. Because patchwork is in Suggests, this function will only run when it is installed.

Usage

grid_spr_inputs(
  plots,
  order = NULL,
  ncol = 1,
  nrow = NULL,
  guides = c("collect", "keep"),
  title = NULL,
  caption = NULL
)

Arguments

plots

A named list of ggplot objects returned by plot_spr_inputs().

order

Character vector giving the plot names (in plots) in the order to arrange. Defaults to names(plots).

ncol

Number of columns in the grid.

nrow

Optional number of rows. If NULL, patchwork chooses automatically.

guides

Passed to patchwork::plot_layout(guides = ...). Default "collect" collects legends when possible.

title

Optional figure title (character). Added with patchwork::plot_annotation().

caption

Optional figure caption (character). Added with patchwork::plot_annotation().

Value

A patchwork object (a ggplot-like object) that can be printed or saved.

Details

Typical usage:


  inp_plots <- plot_spr_inputs(inp, panels = c("mat_selex","wt","len","M"))
  grid_spr_inputs(inp_plots, order = c("mat_selex","wt","len","M"), ncol = 1)