This function takes a ggplot
or list of ggplot
s and writes them to a (multipage) file. See below for details.
save_multipage( gg = last_plot(), filename, device = NULL, path = NULL, scale = 1, width = NA, height = NA, units = c("mm", "cm", "in"), dpi = 300, limitsize = TRUE, return_input = FALSE, multiple_files = FALSE, ... )
gg | A |
---|---|
filename | File name to create on disk. |
device | Device to use. Can either be a device function
(e.g. |
path | Path to save plot to (combined with filename). |
scale | Multiplicative scaling factor. |
width, height | Dimensions of the saved plot. If not specified, |
units | Unit dimensions. Defaults to "mm". |
dpi | Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster output types. |
limitsize | When |
return_input | Return the input ggplot or plotlist is after saving.
This enables the use within |
multiple_files | Save pages as individal files. |
... | Other arguments passed on to the graphics device function,
as specified by |
Handling of multiple pages.
For a list of ggplot
s, each list element is rendered as a separate page into a mutipage pdf
file.
To save pages as individual files, use multiple_files = TRUE
.
For output formats that do not support multipage files (png
, jpg
, etc), pages are saved to individual files by default.
Handling of file dimensions. Output file dimensions are determined according the the following precedence.
The width
and height
parameters of save_multipage()
.
Dimensions inferred from an incoming ggplot
object containing absolute dimensions.
System default device dimensions.