Skip to content

Using split.screen

2 messages · Anon., Brian Ripley

#
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
#
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
[,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: