[R] Multi-plot figures with different numbers of plots in different rows

Anne York york at zipcon.net
Sat Mar 26 19:20:12 CET 2005



On Sat, 26 Mar 2005, Hess, Stephane wrote:

HS > Dear all, 
HS > 
HS > I have 5 plots that I would like to include in a single figure, spread over two rows. If I use mfrow=c(2,3), and produce my plots one after the other, I will end up with three plots in the first row, and 2 in the second row, which is what I want. However, I would like the two plots in the second row to be moved to the centre of that row, rather than occupying the two left-most cells.
HS > 
HS > I have also considered using split.screen, but this would mean that the plots in the lower half would be wider than in the upper half, whereas I want them all to be of the same size.
HS > 
HS > Thanks in advance for any suggestions on how this can be done.
HS > 
HS > Stephane
HS > 
HS > 
HS > --------------------------------------------------------------------------------------
HS > Mr Stephane Hess
HS > Centre for Transport Studies
HS > Imperial College London
HS > -------------------------------------------------------------------------------------- 


Here is a brute force way:

par(mfrow=c(2,3)) #set up 2 rows x 3 colums
plot(1:10) #plot 1
plot(1:10) #plot 2
plot(1:10) #plot 3
par(mfg=c(2,2))  # start next plot at 2,2 instead of 2,1
 plot(1:10)       # 4th plot




More information about the R-help mailing list