View source: R/arrange_plots_function.R
arrange_plots | R Documentation |
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/
arrange_plots(..., nrow = NULL, ncol = NULL, as.table = FALSE)
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. |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.