Save a ggplot to disk in multiple formats and resolutions. By default, raster formats are saved at both 300 and 600 dpi.
Arguments
- plot
A
ggplotobject.- path
Output file path (extension determines format if
formatnot specified).- format
Output format.
- dpi
Resolution for raster formats.
- width
Plot width.
- height
Plot height.
- units
Size units.
- background
Background colour.
- multi_dpi
Logical; write both 300 and 600 dpi versions for raster formats?
Examples
corpus <- sm_example_corpus(n_works = 20)
p <- sm_plot_production(corpus)
path <- tempfile(fileext = ".png")
sm_export_figure(p, path, multi_dpi = FALSE)
#> ✔ Saved figure to: /tmp/RtmpIQMgiF/file237042337c62.png