[R] multiple plots and postscript()

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Mar 6 23:45:11 CET 2003


On Fri, 7 Mar 2003, Robin Hankin wrote:

> Kia Ora everybody.
> 
> There must be an obvious answer to this, but I can't see it....
> 
> I want four square plots in one postscript file.  The canonical answer
> would be:
> 
> postscript(file="~/f.ps",width=5,height=5)
> par(pty="s",mfrow=c(2,2))
> plot(1:19,xlab="")
> plot(1:19,xlab="")
> plot(1:19,xlab="")
> plot(1:19,xlab="")
> dev.off()
> 
> But this isn't quite what I want because there is too much space
> between the individual plots.  The problem does not occur in quite the
> same way on the X11() device (why is there a difference?)

Font size.  For 4 plots on 5" x 5" (or even for 1) you want to reduce the 
pointsize, which is designed for A4 paper.

> What is the best way to control this aspect of the plot if I want
> postscript output?

More generally, par(mar)/par(mai).  Note that this defaults to rows, and 
hence gives marginal space proportional to the pointsize.

-- 
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