Saves a ggplot object by opening the target device directly and printing
the plot, rather than going through ggplot2::ggsave()'s own device-
resolution and dimension-guessing logic. Produces the same output as
ggsave(filename, plot, device = device, width = width, height = height, dpi = dpi, ...) with units = "in".
Usage
.save.ggplot.fast(
plot,
filename,
width,
height,
dpi = 300,
device = ragg::agg_jpeg,
...
)Arguments
- plot
A ggplot object.
- filename
File path to save to.
- width
Numeric, plot width in inches.
- height
Numeric, plot height in inches.
- dpi
Numeric, resolution in dots per inch. Default
300, matchingggplot2::ggsave()'s default.- device
A ragg device-opening function, e.g.
ragg::agg_jpegorragg::agg_png. Defaultragg::agg_jpeg.- ...
Additional arguments passed to
device(), e.g.method = "fast"orquality =forragg::agg_jpeg().