[英]R: Plotly and subplot(): fastest way to create a subplot based on a factor
[英]Create subplots in a subplot in R
您可以使用layout
function 來排列圖形。 layout
采用一個矩陣,指示將繪圖添加到圖形設備的順序。
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")
您需要確保圖形設備足夠大以接收大量繪圖。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.