2016-05-17 5 views
1

2つの円グラフと3つのボックスプロットを1つの図に結合したいと考えています。一番上に2つの円グラフ、一番下に3つのボックスプロットが必要です。 par(mfrow=c(2,3))を使用した場合、最初の行に2つの円グラフと1つのボックスプロットが表示されます。複数の図を1つにまとめる

答えて

1

あなたは、異なるサイズのプロットを作成する必要がありますここで注意

layout(matrix(c(1,1,1,2,2,2,3,3,4,4,5,5), nrow = 2, ncol = 6, byrow = TRUE)) 
plot(1,main=1,ylab="A") 
plot(2,main=2,ylab="B") 
plot(3,main=3,ylab="C") 
plot(4,main=4,ylab="D") 
plot(5,main=5,ylab="E") 

enter image description here

のようなレイアウト

を使用することができ、あなたはここで(最小の部分にあなたのレイアウトマトリックスを分割する必要がありますプロットの1/6)

あなたは次のことを確認してください、このようなマトリックス(異なるnumber-異なるプロット)

 [,1] [,2] [,3] [,4] [,5] [,6] 
[1,] 1 1 1 2 2 2 
[2,] 3 3 4 4 5 5 

またはmatrix(c(1,1,1,2,2,2,3,3,4,4,5,5), nrow = 2, ncol = 6, byrow = TRUE)

+0

うーん..あなたは何を意味するのですか?あなたはもう少し解明できますか? – Batanichek

+0

最初のプロットを 'A'、2番目のプロットを 'B'、3番目のプロットを 'C'などとしたいと思います。 – munna

+0

プロットのタイトル(プロットの 'main =')?または、他の何か? – Batanichek

0

あなたは1行または行と列に複数の図をプロットするためにRでgrid概念を使用することができますが必要参考のために:

plot(1:3) 
grid(NA, 5, lwd = 2) # grid only in y-direction 

## maybe change the desired number of tick marks: par(lab = c(mx, my, 7)) 
op <- par(mfcol = 1:2) 
with(iris, 
    { 
    plot(Sepal.Length, Sepal.Width, col = as.integer(Species), 
      xlim = c(4, 8), ylim = c(2, 4.5), panel.first = grid(), 
      main = "with(iris, plot(...., panel.first = grid(), ..))") 
    plot(Sepal.Length, Sepal.Width, col = as.integer(Species), 
      panel.first = grid(3, lty = 1, lwd = 2), 
      main = "... panel.first = grid(3, lty = 1, lwd = 2), ..") 
    } 
    ) 
par(op) 

MULTIPLE-FIGURES-IN-ONE-ROW

関連する問題