multiplot: multiplot() Multiple plot function

Description Usage Arguments Value Examples

View source: R/multiplot.R

Description

multiplot() Multiple plot function

Usage

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

Arguments

...

other parameters passed from ggplot

plotlist

a list of ggplots

cols

number of columns in the output grid

layout

a matrix describing layout of the output

Value

a page layout of ggplots

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(ggplot2)
p1 <- ggplot(ChickWeight, aes(x=Time, y=weight, colour=Diet, group=Chick)) +
geom_line() +
ggtitle("Growth curve for individual chicks")
p2 <- ggplot(ChickWeight, aes(x=Time, y=weight, colour=Diet)) +
geom_point(alpha=.3) +
geom_smooth(alpha=.2, size=1) +
ggtitle("Fitted growth curve per diet")
p3 <- ggplot(subset(ChickWeight, Time==21), aes(x=weight, colour=Diet)) +
geom_density() +
ggtitle("Final weight, by diet")
p4 <- ggplot(subset(ChickWeight, Time==21), aes(x=weight, fill=Diet)) +
geom_histogram(colour="black", binwidth=50) +
facet_grid(Diet ~ .) +
ggtitle("Final weight, by diet") +
theme(legend.position="none")
multiplot(p1,p2,p3,p4,cols=2)

Vancamjr/jvctools documentation built on Oct. 15, 2020, 5:16 p.m.