[R] Using split.screen

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jan 8 16:32:07 CET 2004


NDC is a coordinate system with (0,0) at the bottom left and (1,1) at the 
top right of the device region.

Take a look at your matrix

> matrix(c(0,0.5,0,0.5,  0.5,1,0.5,1), byrow=F, ncol=4)
     [,1] [,2] [,3] [,4]
[1,]  0.0  0.0  0.5  0.5
[2,]  0.5  0.5  1.0  1.0
      left right bot top

so both your figures are 0 wide and 0 tall.  How about

split.screen(matrix(c(0,0.5,0,0.5,  0.5,1,0.5,1), byrow=T, ncol=4))

If you mess up the layout, you do need to do close.screen(all=TRUE) to 
proceed.


On Thu, 8 Jan 2004, Anon. wrote:

> I want to draw a figure with several panels of unequal size, so i 
> thought I would try using screen().  However, I can't figure out how to 
> define the sizes as a matrix.  I've tried this:
> 
> split.screen(matrix(c(0,0.5,0,0.5,  0.5,1,0.5,1), byrow=F, ncol=4))
> 
> and a couple of variants on it, but get the same error:
> 
> Error in par(.split.screens[[cur.screen]]) :
>          invalid value specified for graphics parameter "fig".
> 
> The help usefully says that they are defined in NDC units, but I don't 
> know what an NDC unit is, and there isn't any example.  The code in 
> kjetil brinchmann halvorsen's message on R-help on  Mar 31 2003 (do a 
> search for "NDC units"!) didn't work either, it gives the same message:
> 
>  > split.screen( matrix( c(0, 0.3, 0.5, 1, 0.3, 0.7, 0.5, 1,
> + + 0.7, 1, 0.5, 1, 0, 0.5, 0, 0.5,
> + + 0.5, 1, 0, 0.5), 5, 4, byrow=TRUE))
> Error in par(.split.screens[[cur.screen]]) :
>          invalid value specified for graphics parameter "fig".
> 
> I get the same in R-1.8.1 on Windows, and R-1.5.1 on Linux.
> As Kjetil pointed out then, "NDC" is not explained in the help pages, 
> and I don't have my copy of MASS with me.
> 
> Bob
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list