Build several frames of different sizes in one window

Consider the following example:

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

How do I make my first chart ( image(...)

titled my wide plot

) take 3 frames on top of the window?

+3


source to share


1 answer


A simple way would be to use layout()

:

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")

      



enter image description here

(For a good example of a more complex layout, see here .)

+4


source







All Articles