exportFig: Exporting a graphic figure

Description Usage Arguments

View source: R/exportFig.R

Description

This function provides a simple interface to export figures generated in R to multiple formats.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
exportFig(
  figure,
  filename = "figure",
  widthpx = 1920,
  heightpx = 1080,
  res = 200,
  format = c("png", "pdf"),
  dir = "output",
  prefix = "date",
  replace = F
)

Arguments

figure

the graphics to be exported.

filename

a string which the name of the figure to be exported

widthpx

an integer which specifies the width of the exported figure in pixels

heightpx

an integer which specifies the height of the exported figure in pixels

res

an integer which specifies the resolution of the exported figure for png.

format

a character vector which specifies the exported format(s). Currently supports "png" and "pdf".

dir

a character string which specifies the directory that the figure will be exported, relative to the current working directory. If the directory does not exist, it will be created.

prefix

a character string which specifies the time of prefix. "date" specifies the current date, "time" prefixes both the date and time to the filename, and NULL removes the prefix altogether.

replace

a logical value. If set to TRUE, files with the same file name will be overwritten on export. If set to FALSE, the software will check for duplicate filenames and append a padded integer to the filename to avoid overwriting.


wayneliuq/wmisc documentation built on Dec. 23, 2021, 5:08 p.m.