Skip to contents

Save a plot using canonical lab figure specifications

Usage

save_lab(
  plot,
  filename,
  spec,
  ncol = 1,
  nrow = 1,
  journal = "cell",
  dpi = NULL,
  bg = "white",
  device = NULL,
  validate_fonts = TRUE,
  validate_output = TRUE,
  min_output_size_bytes = NULL,
  create_dirs = TRUE,
  ...
)

Arguments

plot

A ggplot object.

filename

Output file path.

spec

Canonical figure specification such as "2x2" or "4.9x4.9".

ncol

Number of panel columns represented by the output figure.

nrow

Number of panel rows represented by the output figure.

journal

Journal preset used for dpi and minimum text validation.

dpi

Optional dpi override.

bg

Background color passed to ggplot2::ggsave().

device

Optional graphics device. Defaults from file extension. Use "auto" to force extension-based detection or "quartz_pdf" for native macOS PDF output.

validate_fonts

Whether to enforce journal minimum text size.

validate_output

Whether to check that the output file exists and is not suspiciously small after saving.

min_output_size_bytes

Optional minimum output file size. If NULL, a conservative default is chosen from the file extension.

create_dirs

Whether to create parent directories automatically.

...

Additional arguments passed to ggplot2::ggsave().

Value

The output filename, invisibly.