试试这个:
par(mfrow = c(2, 2))
tapply(iris$Sepal.Length, iris$Species, hist)
Run Code Online (Sandbox Code Playgroud)

但是,对于多面板图,您可能会发现格子或ggplot2贴图更合适.
library(lattice)
histogram(~ Sepal.Length | Species, iris)
Run Code Online (Sandbox Code Playgroud)

library(ggplot2)
ggplot(iris, aes(Sepal.Length)) + geom_histogram() + facet_wrap(~ Species)
Run Code Online (Sandbox Code Playgroud)
