Save Monitor Plots to Files

save_monitor_plots(
  plots,
  path,
  device = c("png", "pdf"),
  dpi = 150,
  verbose = 1
)

Arguments

plots

Result of plot_monitor(), or several of them bound with rbind().

path

Folder to write to (created if needed).

device

"png" (default) or "pdf".

dpi

Resolution for PNG files. Default 150.

verbose

0 (silent) or 1 (summary, default).

Value

Invisibly, a data.table with location, type, file and saved (FALSE when the plot could not be saved; a warning names the reason). Files are named station_<location>_<type>.<device>.

Examples

mon <- run_monitor(tidypptsda::nedap, verbose = 0)
p <- rbind(plot_monitor(mon, "trend"), plot_monitor(mon, "intake"))
dir <- file.path(tempdir(), "monitor_plots")
save_monitor_plots(p, dir)
#> ✔ Saved 4 of 4 plots to /tmp/RtmpBRLQC3/monitor_plots
unlink(dir, recursive = TRUE)
mon <- run_monitor(tidypptsda::nedap, verbose = 0)
dir <- file.path(tempdir(), "monitor_plots")
save_monitor_plots(plot_monitor(mon, "trend"), dir)
#> ✔ Saved 2 of 2 plots to /tmp/RtmpBRLQC3/monitor_plots
unlink(dir, recursive = TRUE)