combine_plots: Combines several ggplot objects (plots) into one figure.

View source: R/combine_plots.R

combine_plotsR Documentation

Combines several ggplot objects (plots) into one figure.

Description

Sometimes we want to put several (ggplot) plots together in one figure for publication. combine_plots does exactly that, allowing additional parameters to control the alignment and index labels of the individual plots, and etc.

Usage

combine_plots(
  ...,
  align = "v",
  ncol = 2,
  labels = "auto",
  label_size = 10,
  title = "Grand Title",
  title_size = 12
)

Arguments

...

Several ggplot objects. Pass in no more than 6 to avoid crowdness.

align

Specifies whether the plots should be horizontally ("h") or vertically ("v") aligned. Options are "none", "h", "v" (default), and "hv" (align in both directions).

ncol

Number of columns in the plot grid. Default = 2.

labels

List of labels to be added to the plots. You can also set labels="auto" (default) to auto-generate lower-case labels (a. b. c. d. ...), labels="AUTO" for upper-case labels (A. B. C. D. ...), or labels='autonum' for integer labels (1. 2. 3. 4. ...).

Value

A ggplot object that shows multiple graphs in one figure.

Examples

inst/examples/ex-combine_plots.R

gmlang/ezplot documentation built on Sept. 18, 2022, 6:33 a.m.