2015-06-09 78 views
3

考慮這個例子:情節多幀

par(mfrow=c(2,3)) 
frame() 
image(matrix(1:100, nrow=100), main="my wide plot", axes=FALSE) 
frame() 
plot(rnorm(120), rnorm(120), main="plot 1") 
plot(dpois(0:20, lambda=6), type="b", main="plot 2") 
x = rnorm(100) 
y = x+runif(100, 10, 12) 
plot(x=x, y=y, , main="plot 3") 

enter image description here

我該怎麼做才能讓我的第一張圖(image(...)題爲my wide plot)佔據頂部的3張窗戶?

回答

4

一個簡單的方法是使用layout():(。對於更爲複雜的佈局的一個很好的例子,see here

layout(mat=matrix(c(1,1,1,2,3,4), ncol=3, byrow=TRUE)) 

image(matrix(1:100, nrow=100), main="my wide plot", axes=FALSE)  
plot(rnorm(120), rnorm(120), main="plot 1") 
plot(dpois(0:20, lambda=6), type="b", , main="plot 2") 
x = rnorm(100) 
y = x+runif(100, 10, 12) 
plot(x=x, y=y, main="plot 3") 

​​