resizing a plot area when using mfrow
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. 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,
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