Skip to contents

Single export entry point for all nmpilot plots: plot methods return the ggplot object and leave saving to this function.

Usage

nm_export_plot(
  plot,
  output_file,
  width = 9,
  height = 5,
  dpi = 300,
  verbose = TRUE,
  ...
)

Arguments

plot

A ggplot (or patchwork) object.

output_file

Output path. The file type is taken from the extension: .jpg/.jpeg, .png, .pdf or .tif/.tiff. The directory is created if needed. (Formerly file, still accepted with a warning.)

width

Width in inches (default 9).

height

Height in inches (default 5).

dpi

Resolution in dots per inch (default 300; ignored for PDF).

verbose

Print the path of the written file (default TRUE).

...

Former argument name, accepted with a warning until version 1.0.

Value

The path of the written file (invisibly), or NULL if plot is NULL.

Examples

if (FALSE) { # \dontrun{
p <- nm_plot_dv(nm_read_csv("data.csv")$data)
nm_export_plot(p, "figures/dv_vs_time.png")
} # }