Skip to content

Arranging Plots

3 messages · Rau, Roland, Sean Davis, Barry Rowlingson

#
Dear all,

I'd appreciate any hints how to arrange some plots.
I have three plots. I would like to arrange them in the following order:
- Plot 1 and Plot 2 should be in the upper row
- Plot 3 should be in the lower row but centered in the middle.

I hope the following sketch will help understanding my problem
================
| ===    ===   |
|| P1|  |P2 |  |
||   |  |   |  |
| ===    ===   |
|    ====      |
|   |P3  |     |
|   |    |     |
|    ====      |
================

I tried already things
split.screen(c(2,1))
split.screen(c(1,2), screen=1)
screen(3)
### plotting of Plot 1
screen (4)
### plotting of Plot 2
screen(2)
### plotting of Plot 3
close.screen()

but then Plot 3 will be stretched across the whole screen (would be
screen(2)) and I would like to have it just the same width as the other
plots 1 and 2.

Can anyone give me some hints?

Thank you very much!
Roland


+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}
#
On May 19, 2005, at 6:42 AM, Rau, Roland wrote:

            
Roland,

You might want to look into grid graphics.  The link here has lots of 
info.

http://www.stat.auckland.ac.nz/~paul/grid/grid.html

Sean
#
Rau, Roland wrote:

            
?screen

tells you:

     figs: A two-element vector describing the number of rows and the
           number of columns in a screen matrix _or_ a matrix with 4
           columns. If a matrix, then each row describes a screen with
           values for the left, right, bottom, and top of the screen (in
           that order) in NDC units, that is 0 at the lower left coner

  - so by passing a matrix you can put plots anywhere, not just split 
the whole thing into boxes.

  Here's an example, which with a bit of tweaking, might work for you:

  > fm=rbind(c(0,.4,.6,.9),c(.6,.9,.6,.9),c(.3,.8,.1,.4))
  > fm
       [,1] [,2] [,3] [,4]
  [1,]  0.0  0.4  0.6  0.9
  [2,]  0.6  0.9  0.6  0.9
  [3,]  0.3  0.8  0.1  0.4

  each row of fm is (left, right, bottom, top) as a fraction of the 
whole device.

  > split.screen(fm)
  > screen(1)
  > plot(1:10)
  > screen(2)
  > hist(runif(100))
  > screen(3)
  > plot(1:10)

  I've left some space around that you might want to get rid of. Its 90% 
there.

Baz