2
votes

I have 3 figures of which I would like to plot in the same place in R. I would like to have 2 columns, which would make the 3rd figure plotted alone in the second row. Using par(mfrow=c(2,2)) functions in R, is there a way to have the bottom figure plotted in the centre of the plot, as opposed to underneath the top figure?

1

1 Answers

2
votes

I don't think you can do this using par(mfrow = ...)

However, you can use layout().

Try this:

par(mai=rep(0.5, 4))
layout(matrix(c(1,2,3,3), ncol = 2, byrow = TRUE))
plot(1:10)
plot(1:20)
plot(1:30)

enter image description here

So you can see the idea is to create a matrix where each cell indicates which graph to plot. You can extend the logic as follows:

par(mai=rep(0.5, 4))
layout(matrix(c(1,1, 2,2, 0, 3,3, 0), ncol = 4, byrow = TRUE))
plot(1:10)
plot(1:20)
plot(1:30)

enter image description here