Skip to contents

Save a plot with lab figure presets

Usage

save_lab_plot(
  plot,
  filename,
  preset = "cell_half",
  width = NULL,
  height = NULL,
  dpi = NULL,
  units = "cm",
  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.

preset

Named output preset such as "cell_half".

width

Optional override width in cm.

height

Optional override height in cm.

dpi

Optional override resolution.

units

Units 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.