knitAndSave: knitAndSave

View source: R/knitAndSave.R

knitAndSaveR Documentation

knitAndSave

Description

knitAndSave

Usage

knitAndSave(
  plotToDraw,
  figCaption,
  file = NULL,
  path = NULL,
  figWidth = ufs::opts$get("ggSaveFigWidth"),
  figHeight = ufs::opts$get("ggSaveFigHeight"),
  units = ufs::opts$get("ggSaveUnits"),
  dpi = ufs::opts$get("ggSaveDPI"),
  catPlot = ufs::opts$get("knitAndSave.catPlot"),
  ...
)

Arguments

plotToDraw

The plot to knit using knitFig() and save using ggSave().

figCaption

The caption of the plot (used as filename if no filename is specified).

file, path

The filename to use when saving the plot, or the path where to save the file if no filename is provided (if path is also omitted, getWd() is used).

figWidth, figHeight

The plot dimensions, by default specified in inches (but 'units' can be set which is then passed on to ggSave().

units, dpi

The units and DPI of the image which are then passed on to ggSave().

catPlot

Whether to use cat() to print the knitr fragment.

...

Additional arguments are passed on to ggSave(). Note that file (and ...) are vectorized (see the ggSave() manual page).

Value

The knitFig() result, visibly.

Examples

## Not run: plot <- ggBoxplot(mtcars, 'mpg');
knitAndSave(plot, figCaption="a boxplot", file=tempfile(fileext=".png"));
## End(Not run)

ufs documentation built on May 29, 2024, 10:30 a.m.