Skip to contents

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

if (FALSE) {
library(ggplot2)
ggplot(mtcars, aes(mpg, wt)) +
  geom_point()

ggquicksave("mtcars.png")
}