save_png: Open png device and return info on the file being created

View source: R/helper_fxns.R

save_pngR Documentation

Open png device and return info on the file being created

Description

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.

Usage

save_png(
  plotinfo,
  file,
  plotdir,
  pwidth,
  pheight,
  punits,
  res,
  ptsize,
  caption = NA,
  alt_text = NA,
  filenameprefix = NA
)

Arguments

plotinfo

table of information about all plots

file

filename to write to (including .png extension)

plotdir

directory where plots will be written

pwidth

Default width of plots printed to files in units of punits. The default is pwidth=6.5.

pheight

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.

punits

Units for pwidth and pheight. Can be "px" (pixels), "in" (inches), "cm" (centimeters), or "mm" (millimeters). The default is punits="in".

res

Resolution of plots printed to files. The default is res = 300.

ptsize

Point size for plotted text in plots printed to files (see help("png") in R for details).

caption

caption for the image

alt_text

alternative text for screen readers (if left as NA then will be set based on the caption)

filenameprefix

Additional text to append to PNG or PDF file names. It will be separated from default name by an underscore.

Author(s)

Ian G. Taylor


r4ss documentation built on May 28, 2022, 1:11 a.m.