arrange_plots: Arrange Multiple Plots on a Page

View source: R/arrange_plots_function.R

arrange_plotsR Documentation

Arrange Multiple Plots on a Page

Description

This function places a list of ggplot objects into a single object. taken from RBloggers, 3July12, combining ggplot images https://www.r-bloggers.com/combining-ggplot-images/

Usage

arrange_plots(..., nrow = NULL, ncol = NULL, as.table = FALSE)

Arguments

nrow

Number of rows of plots, defaults to NULL

depends: ggplot2, grid

ncol

Number of columns of plots, defaults to NULL

plotlist

A list of plots to be arranged. Defaults to NULL.

Examples

x <- rnorm(100, 10, 3)
y <- rnorm(200, 10, 3)
test.dat <- as.data.frame(cbind(x, y))
fig.1 <- ggplot2::ggplot(test.dat, aes(x,y)) + geom_point()
fig.2 <- ggplot2::ggplot(test.dat[which(test.dat$x > 5),], aes(x,y)) + geom_point()

  p1 <- qplot(wt, mpg, data=mtcars)
  p2 <- ggplot(diamonds, aes(price, colour = cut)) +
                     geom_density()
   arrange_plots(p1,p2)


JenC36/JACtools documentation built on Oct. 20, 2024, 8:05 a.m.