/saveplot

Utility functions for saving high quality plots in R.

Primary LanguageRBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

saveplot

saveplot is an R package of utility functions for saving high quality plots to svg and png formats for publication in print and online.

Installation

Install from GitHub using devtools.

install.packages("devtools")
devtools::install_github("olihawkins/saveplot")

Saving plots

Use save_svg and save_png to save plots to each format.


saveplot::save_svg(plot, filename, width, height)

Save an svg with the following arguments:

  • plot A plot object.
  • filename Filename to save to an svg.
  • width Width of the image in inches.
  • height Height of the image in inches.

saveplot::save_png(plot, filename, width, height, ppi = 400)

Save a png with the following arguments:

  • plot A plot object.
  • filename Filename to save to a png.
  • width Width of the image in inches.
  • height Height of the image in inches.
  • width Number of pixels per inch for the png.