write_plots {fasstr} | R Documentation |
Write plots from a list into a directory or PDF document
Description
Write a list of plots (ggplots; as used by fasstr
) into a directory or PDF document.
When writing into a named directory each plot will be named by the plot name listed in the list; uses ggplot2::ggsave
function. When writing into a PDF document (combined_pdf == TRUE
) the plot names will not appear; uses
grDevices::pdf
function.
Usage
write_plots(
plots,
folder_name,
plot_filetype,
width,
height,
units = "in",
dpi = 300,
combined_pdf = FALSE
)
Arguments
plots |
List of plots to write to disk. |
folder_name |
Name of folder to create on disk (if it does not exist) to write each plot from list.
If using |
plot_filetype |
Image type to write. One of |
width |
Numeric plot width in |
height |
Numeric plot height in |
units |
Character string plot height and width units, one of |
dpi |
Numeric resolution of plots. Default |
combined_pdf |
Logical value indicating whether to combine list of plots into one PDF document. Default |
Examples
## Not run:
# Working examples:
# Example plots to save
plots <- plot_annual_lowflows(station_number = "08NM116")
# Write the plots as "png" files
write_plots(plots = plots,
folder_name = "Low Flow Plots",
plot_filetype = "png")
# Write the plots as a combined "pdf" document
write_plots(plots = plots,
folder_name = "Low Flow Plots",
combined_pdf = TRUE)
## End(Not run)