This function is vectorized over all argument except 'plot': so if you
want to save multiple versions, simply provide vectors. Vectors of length
1 will be recycled using rep()
; otherwise vectors have to all be the same
length as file
.
ggSave(
file = NULL,
plot = ggplot2::last_plot(),
width = ufs::opts$get("ggSaveFigWidth"),
height = ufs::opts$get("ggSaveFigHeight"),
units = ufs::opts$get("ggSaveUnits"),
dpi = ufs::opts$get("ggSaveDPI"),
device = NULL,
type = NULL,
bg = "transparent",
preventType = ufs::opts$get("ggSavePreventType"),
...
)
The plot, invisibly.
The file where to save to.
The plot to save; if omitted, the last drawn plot is saved.
The dimensions of the plot, specified in units
.
The units, 'cm'
, 'mm
', or 'in'
.
The resolution (dots per inch). This argument is vectorized.
The graphic device; is inferred from the file if not specified.
An additional arguments for the graphic device.
The background (e.g. 'white').
Whether to prevent passing a value for the type
argument
to ggplot2::ggsave()
. This is prevented by default since ggplot2::ggplot()
switched
to using the ragg device by default, resulting in throwing a warning
("Warning: Using ragg device as default. Ignoring type
and antialias
arguments")
if something if passed for 'type'.
Any additional arguments are passed on to ggplot2::ggsave()
.
plot <- ufs::ggBoxplot(mtcars, 'mpg');
ggSave(file=tempfile(fileext=".png"), plot=plot);
Run the code above in your browser using DataLab