lay_out: Arrange ggplot2 plots in an arbitrary grid

Description Usage Arguments Details Value Author(s) Examples

View source: R/utility_functions.r

Description

Arrange ggplot2 plots in an arbitrary grid

Usage

1

Arguments

...

A series lists of of ggplot objects

Details

The function takes arguments of the form 'list(plot, row(s), column(s))' where 'plot' is a ggplot2 plot object, and the rows and columns identify an area of the grid that you want that plot object to occupy. See http://stackoverflow.com/questions/18427455/multiple-ggplots-of-different-sizes

Value

A grid of ggplot2 plots

Author(s)

Extracted from the [wq] package

Examples

1
2
3
4
5
6
7
8
9
library(ggplot2)
p1 <- qplot(x=wt,y=mpg,geom="point",main="Scatterplot of wt vs.
    mpg", data=mtcars)
p2 <- qplot(x=wt,y=disp,geom="point",main="Scatterplot of wt vs
    disp", data=mtcars)
p3 <- qplot(wt,data=mtcars)
lay_out(list(p1, 1:2, 1:4),
      list(p2, 3:4, 1:2),
      list(p3, 3:4, 3:4))

socviz documentation built on July 1, 2020, 7:04 p.m.