magicPlot: Conveniently save a plot to a file

Description Usage Arguments Value

View source: R/PlotUtils.R

Description

Basically a convenience wrapper that opens graphical device (with Cairo), saves the provided ggplot object and closes it again. Helpfully it will automatically calculate and use an aspect ratio if possible (and not provided).

Usage

1
magicPlot(p, filename, type = "png", height = NULL, width = NULL, ...)

Arguments

p

The plot to be saved.

filename

The filename of the saved plot (character string) omitting the file type extension

type

The type of file to make, defaults to "png" but also "pdf" and others are possible (see options to Cairo::Cairo function)

height, width

The height and width of the plot (as numeric) units will depend on the type parameter, it is pixels for "png" and inches for "pdf

...

Passed to Cairo function

Value

Nothing, function prints a plot to a file.


MagicForrest/MagicUtils documentation built on Dec. 17, 2021, 2:16 a.m.