this was previously contained within each of the SSplotXXX() functions. It (1) translates the not-quite-matching specifications for the image to the values needed by png(), then (2) returns the plotinfo data.frame (which exists within each function which calls this) after adding a row with the filename and caption for each new plot Note: this just opens the png device which needs to be closed via dev.off() outside this function.
save_png(
plotinfo,
file,
plotdir,
pwidth,
pheight,
punits,
res,
ptsize,
caption = NA,
alt_text = NA,
filenameprefix = NA
)
table of information about all plots
filename to write to (including .png extension)
directory where plots will be written
Default width of plots printed to files in units of
punits
. The default is pwidth=6.5
.
Height of plots printed to png files in units of punits
.
Default is designed to allow two plots per page, with pheight_tall
used
for plots that work best with a taller format and a single plot per page.
Units for pwidth
and pheight
. Can be "px"
(pixels), "in" (inches), "cm" (centimeters), or "mm" (millimeters).
The default is punits="in"
.
Resolution of plots printed to files.
The default is res = 300
.
Point size for plotted text in plots printed to files (see
help("png")
in R for details).
caption for the image
alternative text for screen readers (if left as NA then will be set based on the caption)
Additional text to append to PNG or PDF file names. It will be separated from default name by an underscore.