A wrapper around ggplot2::ggsave() with journal column widths, a
white background and 300 dpi by default. Works for ggplot and patchwork
objects.
Arguments
- plot
A ggplot or patchwork object.
- filename
File name; the extension sets the format (
.png,.pdf,.tiff,.svg, ...).- size
"single"(85 mm wide),"onehalf"(120 mm) or"double"(175 mm) column width. Ignored ifwidthis given.- width, height
Size in
units.heightdefaults to 0.8 x width.- units
Units for
widthandheight("mm","cm","in", or"px").- dpi
Resolution for raster formats (default 300).
- ...
Passed to
ggplot2::ggsave().
See also
tidymapr::geo_save() for map-oriented defaults (path,
180x140 mm).
Examples
r <- div_rarefy(png_ants, q = 0, .by = season, knots = 20)
f <- tempfile(fileext = ".png")
plot_save(ggplot2::autoplot(r), f, size = "single")