ggsave_auto: Save and open a ggplot

View source: R/plot-save-render.R

ggsave_autoR Documentation

Save and open a ggplot

Description

Wrapper around ggplot2::ggsave() that renders the last ggplot/grob as an image to a special folder and opens it using the system's default app for the graphic type.

Usage

ggsave_auto(..., load_as_magick = FALSE)

Arguments

...

Passed to ggplot2::ggsave(), overriding path and filename.

load_as_magick

Whether to show information about the saved plot and invisibly return an ImageMagick object of the plot for post-processing. Defaults to FALSE.

Value

A magick object or path to the saved plot.

Note

Creates a folder ⁠/.ggsave_auto⁠ in the working directory where figures are saved with zero-padding to 3 digits (e.g., ⁠ggsave_auto-001.png⁠). Appends .ggsave_auto to a .gitignore file if it exists.

Global params can be set through options(), with the argument name followed by pgl.ggsave_auto. such as options(pgl.ggsave_auto.width = 7).


yjunechoe/penngradlings documentation built on Sept. 6, 2024, 8:13 p.m.