Skip to content

resizing a plot area when using mfrow

3 messages · Rajarshi Guha, Marc Schwartz

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

Currently I take the EPS and then cut out the white boundaries in a
image manipulation program. 

Is there someway I can specify in R that the plot area should resize to
just enclose the row of plots without generating large areas of
whitespace?

Thanks,
-------------------------------------------------------------------
Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
C Code.
C Code Run.
Run, Code, RUN!
PLEASE!!!!
#
On Mon, 2004-02-16 at 12:31, Rajarshi Guha wrote:
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()

Take a look at RPlot.eps and see if this is what you require.

HTH,

Marc Schwartz
#
On Mon, 2004-02-16 at 14:53, Marc Schwartz wrote:
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