[R] multiframe in postscript

Chong Gu chong at stat.purdue.edu
Mon Dec 18 15:38:04 CET 2000


   Date: Sun, 17 Dec 2000 18:08:45 +0000 (GMT)
   From: Prof Brian D Ripley <ripley at stats.ox.ac.uk>
   Sender: ripley at auk.stats
   cc: r-help at stat.math.ethz.ch
   MIME-Version: 1.0
   Content-Type: TEXT/PLAIN; charset=US-ASCII

   On Sun, 17 Dec 2000, Chong Gu wrote:

   > 
   > I was hoping that the following specification
   > 
   >     postscript(file="fig.ps",height=2,width=4)
   >     par(mar=c(5,5,2,2)+.1,mfrow=c(1,2),mex=.6)
   > 
   > would yield the same scaling effect as
   > 
   >     postscript(file="fig.ps",height=2,width=6)
   >     par(mar=c(5,5,2,2)+.1,mfrow=c(1,3),mex=.6)
   > 
   > but the fact is that the 'mfrow=c(1,2)' yields smaller plotting frame
   > and bigger font size.  Some experiments show that the device scales
   > differently for two or less rows (columns) and three or more rows
   > (columns).
   > 
   > Is this a feature or "bug"?
   > 
   > I am running R-1.2, but I doubt the version matters here.

   It is a feature, copied from S.  It is only the font scaling (and
   everything that depends on it) which depends on the mfrow/col layout.
   Here's the C code exerpt (in par.c):

	   if (nrow > 2 || ncol > 2) {
	       dd->gp.cexbase = dd->dp.cexbase = 0.66;
	       dd->gp.mex = dd->dp.mex = 1.0;
	   }
	   else if (nrow == 2 && ncol == 2) {
	       dd->gp.cexbase = dd->dp.cexbase = 0.83;
	       dd->gp.mex = dd->dp.mex = 1.0;
	   }
	   else {
	       dd->gp.cexbase = dd->dp.cexbase = 1.0;
	       dd->gp.mex = dd->dp.mex = 1.0;
	   }

   So you want to set cex=0.66 in the first case, I think.  (The details
   are not quite the same as S, as far as I recall.)

   -- 
   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 272860 (secr)
   Oxford OX1 3TG, UK                Fax:  +44 1865 272595


Thanks to Professor Ripley for the clarification.  After my post, I
found a way to cheat R out of this one by using layout instead of
mfrow.  Here is what I did to achieve uniform scaling.

    postscript(file="fig.ps",height=2,width=4)
    layout(matrix(c(1,0,2),1,3),c(1,0,1),1)
    par(mar=c(5,5,2,2)+.1,mex=.6)

    postscript(file="fig.ps",height=2,width=6)
    layout(matrix(c(1,2,3),1,3))
    par(mar=c(5,5,2,2)+.1,mex=.6)

Chong
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list