save_ggplot_list: Save a patchwork of ggplot figures to a file

View source: R/Visualizations_general.R

save_ggplot_listR Documentation

Save a patchwork of ggplot figures to a file

Description

This function takes a list of ggplot figures and saves them as a patchwork to a file specified by a base path and filename, split into multiple files if the list is longer than a given split N.

Usage

save_ggplot_list(
  ggLS,
  basepath,
  filename,
  splitN = 20,
  width = 12,
  height = 7,
  units = "in",
  dpi = 150
)

Arguments

ggLS

A list of ggplot figures.

basepath

The base path for the output file.

filename

The name of the output file, not including any extension.

splitN

The number of ggplots to include in each patchwork file (default is 20).

width

The width of the output file in inches (default is 12).

height

The height of the output file in inches (default is 7).

units

The units of the output file (default is "in").

dpi

The resolution of the output file in dots per inch (default is 150).

Examples

## Save a list of ggplot figures to a file
my_ggplots <- list(ggplot(data = mtcars, aes(x = mpg, y = wt)) + geom_point(),
                   ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width)) + geom_point())
save_ggplot_list(ggLS = my_ggplots, basepath = "/path/to/file", filename = "my_ggplots")


eisascience/scCustFx documentation built on June 2, 2025, 3:59 a.m.