方法一
library(ggplot2)
library(patchwork)
p1 <- ggplot(iris,aes(x=Sepal.Length))+geom_histogram(fill='#58a6a6')
p2 <- ggplot(iris,aes(x=Sepal.Width))+geom_histogram(fill='#1c595a')
p3 <- ggplot(iris,aes(x=Petal.Length))+geom_histogram(fill='#daae31')
p4 <-ggplot(iris,aes(x=Petal.Width))+geom_histogram(fill='#d9a035')
(p1+p2)/(p3+p4)#上下各两幅图,然后/表示分行
(p1+p2)/p3/p4