ggarrange: ggarrange

Description Usage Arguments Value Examples

View source: R/gtable_frame.r

Description

Arrange multiple ggplot objects on a page, aligning the plot panels.

Usage

1
2
3
4
5
6
ggarrange(..., plots = list(...), nrow = NULL, ncol = NULL,
  widths = NULL, heights = NULL, byrow = TRUE, top = NULL,
  bottom = NULL, left = NULL, right = NULL, padding = unit(0.5,
  "line"), clip = "on", draw = TRUE, newpage = TRUE, debug = FALSE,
  labels = NULL, label.args = list(gp = grid::gpar(font = 4, cex =
  1.2)))

Arguments

...

ggplot objects

plots

list of ggplots

nrow

number of rows

ncol

number of columns

widths

list of requested widths

heights

list of requested heights

byrow

logical, fill by rows

top

optional string, or grob

bottom

optional string, or grob

left

optional string, or grob

right

optional string, or grob

padding

unit of length one, margin around annotations

clip

argument of gtable

draw

logical: draw or return a grob

newpage

logical: draw on a new page

debug

logical, show layout with thin lines

labels

character labels used for annotation of subfigures

label.args

label list of parameters for the formatting of labels

Value

gtable of aligned plots

Examples

1
2
3
4
5
6
7
p1 <- ggplot(mtcars, aes(mpg, wt, colour = factor(cyl))) +
  geom_point()
p2 <- ggplot(mtcars, aes(mpg, wt, colour = factor(cyl))) +
  geom_point() + facet_wrap( ~ cyl, ncol=2, scales = 'free') +
  guides(colour='none') +
  theme()
ggarrange(p1, p2, widths = c(2,1), labels = c('a', 'b'))

Example output

Loading required package: gridExtra
Loading required package: ggplot2

egg documentation built on July 13, 2019, 9:03 a.m.