Reputation: 3521
I have to use layout to fit 4 image in one plot.
Ist : 1 image
IInd : 3 images
layout(matrix(c(1,1,2,3), 2, 2, byrow = TRUE))
plot(x, y)
hist(x,y)
plot(x*x,y*y)
plot(sqrt(x),sqrt(y))
But output image is not as expected. How can i fix this?
I expect image to be as shown below.
Upvotes: 0
Views: 410
Reputation: 2419
Here is a required code for your question:
layout(matrix(c(1,1,1,2,3,4), 2, 3, byrow = TRUE))
What it does is that the first image occupies the whole first row as denoted by 1
and second, third and fourth images occupies 1st, 2nd and 3rd columns of the second row respectively. So total six cells in the matrix are there (2*3, 2 for rows and 3 for columns).
Upvotes: 2