[R] resizing a plot area when using mfrow

Rajarshi Guha rxg218 at psu.edu
Mon Feb 16 21:00:02 CET 2004


On Mon, 2004-02-16 at 14:53, Marc Schwartz wrote:
> On Mon, 2004-02-16 at 12:31, Rajarshi Guha wrote:
> > Hi,
> >   I'm trying to plot two graphs next to each other using the plot()
> > command. I've used 
> > 
> > par(mfrow=c(1,2),pty='s')
> > 
> > to get the plots on 1 row.
> > However what happens is that I get a large plot area with the 2 plots in
> > the center of it, so there is a large amount of white space above and
> > below the plots.

> One approach is to adjust the page size that you use for the EPS output,
> since you are forcing a square plot region. A rough guess might be to
> use a page width that is twice the page height. Be sure to use 'paper =
> "special"' to adjust the EPS bounding box.
> 
> 
> # Specify the EPS output
> postscript(file = "RPlot.eps", onefile = TRUE, paper = "special",
>            width = 10, height = 5, horizontal = FALSE)
> 
> # Set 1 row, 2 cols, square plot region
> par(mfrow=c(1,2), pty = "s")
> 
> # Generate two plots
> plot(1:5)
> plot(1:10)
> 
> # Close postscript device
> dev.off()

Thanks - that does exactly what I need. 

-------------------------------------------------------------------
Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
Artificial intelligence has the same relation to intelligence as
artificial flowers have to flowers.
-- David Parnas




More information about the R-help mailing list