bro_ggsave_paged: Universal ggplot export function

Description Usage Arguments

View source: R/multiple_plots.R

Description

This function takes a ggplot (for single page) or list of ggplots (for multi page) and writes them to file. In case the input has absolute dimensions (e.g. as a result of egg::set_panel_size() or patchwork::plot_layout()), width and height of the output are adjusted to fit the content.

Usage

1
2
3
4
bro_ggsave_paged(gg = last_plot(), filename, device = NULL,
  path = NULL, scale = 1, width = NA, height = NA,
  units = c("in", "cm", "mm"), dpi = 300, limitsize = TRUE,
  return_input = FALSE, burst_to_multiple_files = FALSE, ...)

Arguments

gg

ggplot or list of ggplots

filename

Filename for export

device

Device to use. Can either be a device function (e.g. png()), or one of "eps", "ps", "tex" (pictex), "pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (windows only).

path

Path to save plot to (combined with filename).

scale

Multiplicative scaling factor.

width, height, units

Plot size in units ("in", "cm", or "mm"). If not supplied, uses the size of current graphics device. In case the input has absolute dimensions after applying patchwork::plot_layout(), width and height of the output are adjusted to fit the content.

dpi

Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster output types.

limitsize

When TRUE (the default), ggsave will not save images larger than 50x50 inches, to prevent the common error of specifying dimensions in pixels.

return_input

If TRUE the input ggplot or plotlist is returned after saving. This enables the use of bro_ggsave_paged() within dplyr pipes.

...

Other arguments passed on to the graphics device function, as specified by device.


jbengler/bro documentation built on Dec. 8, 2019, 12:44 p.m.