Skip to contents

Export figure

Usage

save_plot(
  filename,
  extension = c("pdf", "eps", "png", "all"),
  path = NULL,
  scale = 1,
  dpi = 300,
  plot = ggplot2::last_plot(),
  ...
)

Arguments

filename

filename to be saved, excluding the path and extension.

extension

image extension; also defines the type of image. Valid values are c('pdf', 'eps', 'png', 'all'); note that 'all' will create all image types.

path

path where the file(s) will be saved

scale

rescaling done by ggplot2::ggsave; experimental.

dpi

dots per inch of the output file(s). Typical values are 300 for print (the default) and rarely 72 for web image output. Note that for png images save_plot() multiples the dpi by 2, to compensate for the lower quality compared to vector formats (pdf, eps). Thus, the default dpi for png images is 600.

plot

ggplot2 to save. By default will save the plot last printed to screen.

...

Other arguments passed on to the graphics device function.