[R] Arranging Plots

Barry Rowlingson B.Rowlingson at lancaster.ac.uk
Thu May 19 13:28:06 CEST 2005

Rau, Roland wrote:

> Can anyone give me some hints?


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% 


More information about the R-help mailing list