Use the function grid.arrange()
from the library, gridExtra
. A minimum reprex is given below;
library(ggplot2)
library(gridExtra)
p1 <- qplot(mpg, wt, data = mtcars, colour = cyl)
p2 <- qplot(mpg, data = mtcars) + ggtitle("title")
p3 <- qplot(mpg, data = mtcars, geom = "dotplot")
p4 <-
p1 + facet_wrap( ~ carb, nrow = 1) + theme(legend.position = "none") +
ggtitle("facetted plot")
# grid.arrange(p1, p2, nrow = 1)
grid.arrange(p1, p2, p3, p4, nrow = 2, ncol=2)