Save ggplot2 using sensible defaults for better output
Usage
unhcr_save(plot = ggplot2::last_plot(), filename, dpi = 300, ...)Arguments
- plot
- ggplot2 object, plot to save. Defaults to last plot. 
- filename
- File name to create on disk. 
- dpi
- Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster (png, jpeg and tiff) output types. 
- ...
- extra param to passe to `ggsave`. 
Examples
if (FALSE) {
library(tidyverse)
library(unhcrthemes)
file <- tempfile("unhcrthemes_save", fileext = ".png")
cars |>
  ggplot(aes(speed, dist)) +
  geom_point() +
  theme_unhcr() |>
  unhcr_save(file)
}