save_ggplot: save_ggplot

View source: R/save_ggplot.R

save_ggplotR Documentation

save_ggplot

Description

Save ggplot

Usage

save_ggplot(
  plot,
  filename = NULL,
  path = NULL,
  overwrite = FALSE,
  rm_plot = FALSE,
  ...
)

Arguments

plot

Plot to save.

filename

File name to create on disk. The device (e.g. jpeg) must be specified as file extension.

path

Path to save plot to (combined with filename).

overwrite

If true, existing file is overwritten.

rm_plot

If true, the plot is removed form the environment.

...

Options passed to ggsave.

Details

This function checks if the plot aready exists before saving it. If the file aready exists and 'overwrite = FALSE' (default), the file is not saved. The filename and path is combined using 'file.path()'. See '?ggplot2::ggsave()' for more information.

See Also

ggsave

Examples

## Not run: 
x <- runif(n = 100)
y <- runif(n = 100)
result_plot <- ggplot2::ggplot() + ggplot2::geom_point(ggplot2::aes(x = x, y = y))
save_ggplot(result_plot, filename = "result_ggpplot.jpeg")

## End(Not run)


mhesselbarth/suppoRt documentation built on April 10, 2024, 2:06 p.m.