multiplot: Create multi-panel plots

Description Usage Arguments Value Examples

View source: R/multiplot.R

Description

ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)

Usage

1
multiplot(..., plotlist = NULL, cols = 1, layout = NULL)

Arguments

...

ggplot objects

plotlist

A list of ggplot objects

cols

Number of columns in layout

layout

A matrix specifying the layout. If present, 'cols' is ignored.

Value

a multi-panel plot

If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE), then plot 1 will go in the upper left, 2 will go in the upper right, and 3 will go all the way across the bottom.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(tidyverse)
library(maxxxy)

p1 <- iris %>%
  as_tibble() %>%
  ggplot(aes(Sepal.Width, Sepal.Length, color = Species)) +
  geom_point()

p2 <- iris %>%
  as_tibble() %>%
  ggplot(aes(Sepal.Width, fill = Species)) +
  geom_density(alpha = 0.5)

p3 <- iris %>%
  as_tibble() %>%
  ggplot(aes(Species, Sepal.Width, fill = Species)) +
  geom_boxplot()

multiplot(p1, p2, p3)

MaximilianBernkopf/maxxxy documentation built on Sept. 28, 2021, 1:10 p.m.