You can use the layout
function to arrange graphics plots. layout
takes a matrix that indicates the order in which to add plots to the graphics device.
m1 <- matrix(c(
1, 1, 2, 2,
1, 1, 2, 2,
3, 3, 4, 5,
3, 3, 6, 7), nrow = 4, ncol = 4, byrow = TRUE)
m1
# [,1] [,2] [,3] [,4]
# [1,] 1 1 2 2
# [2,] 1 1 2 2
# [3,] 3 3 4 5
# [4,] 3 3 6 7
layout(m1)
hist(rnorm(100), col = "red")
hist(rnorm(100), col = "orange")
hist(rnorm(100), col = "yellow")
hist(rnorm(100), col = "green")
hist(rnorm(100), col = "lightblue")
hist(rnorm(100), col = "blue")
hist(rnorm(100), col = "violet")
You will need to make sure the graphics device is large enough to receive large numbers of plots.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.