ggquicksave: Call ggsave with default parameters

View source: R/ggplot2_extensions.R

ggquicksaveR Documentation

Call ggsave with default parameters

Description

Calls ggsave with some defaults that I happen to like. As of ggplot2 3.3.4, ggplot2::ggsave() uses ragg as the backend device for saving.

Usage

ggquicksave(
  filename,
  plot = ggplot2::last_plot(),
  width = 9,
  height = 6,
  units = "in",
  dpi = 500,
  ...
)

Arguments

filename

File name to create on disk.

plot

Plot to save, defaults to last plot displayed.

width, height, units

Plot size in units ("in", "cm", "mm", or "px").

dpi

Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72).

...

Other arguments passed to ggplot2::ggsave().

Examples

## Not run: 
library(ggplot2)
ggplot(mtcars, aes(mpg, wt)) +
  geom_point()

ggquicksave("mtcars.png")

## End(Not run)

markjrieke/riekelib documentation built on Dec. 20, 2024, 4:57 a.m.