save_plot: Save a 'ggplot' Object

View source: R/plot.R

save_plotR Documentation

Save a ggplot Object

Description

save_plot() saves a ggplot object to the specified path.

Usage

save_plot(
  gg_obj = ggplot2::last_plot(),
  path,
  ratio = c(16, 9),
  size = 0.75,
  ...
)

Arguments

gg_obj

A ggplot object

path

The location and file for saving the plot. The image type is inferred from the file extension.

ratio

The aspect ratio of the figure; defaults to c(16, 9)

size

The relative size of the figure; defaults to 0.75, meaning that the figure width will be 0.75 * ratio[[1]], and the figure height will be 0.75 * ratio[[2]]. Useful for scaling an aspect ratio without calculating the precise dimensions.

...

Additional arguments to pass to ggsave()

Value

The ggplot object (invisibly)


jesse-smith/coviData documentation built on Jan. 14, 2023, 11:08 a.m.