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

Paul Murrell p.murrell at auckland.ac.nz
Sat Mar 26 20:39:01 CET 2005


Hi


Hess, Stephane wrote:
 > Dear all,
 >
 > 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.
 >
 > 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.


Something like ...?

layout(rbind(c(1, 1, 2, 2, 3, 3),
              c(0, 4, 4, 5, 5, 0)))
for (i in 1:5) {
   plot(i, type="n")
   text(1, i, paste("Plot", i), cex=4)
}

Paul
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/




More information about the R-help mailing list