[R] Question from Newbie on PostScript and Multiple Plots

Johnson, Heather hjohnson at cbmi.pitt.edu
Fri Aug 13 19:10:22 CEST 2004

Marc and Partha,

Thank you both for your suggestions of using par("mfrow"), that's exactly
what I needed to do.  In fact I already had it in the code (which I didn't
write originally) and simply had to put my postscript statement in front of
it. :)

It works great now!  Thanks for the quick responses.


-----Original Message-----
From: Marc Schwartz [mailto:MSchwartz at MedAnalytics.com] 
Sent: Friday, August 13, 2004 11:48 AM
To: Johnson, Heather
Cc: 'r-help at lists.R-project.org'
Subject: Re: [R] Question from Newbie on PostScript and Multiple Plots

On Fri, 2004-08-13 at 11:28, Johnson, Heather wrote:
> Hi,
> As I'm pretty new to R I hope this question isn't too basic.
> I am currently looping through my dataset and for each iteration am 
> producing three separate plots.  When I output these plots to the 
> screen they are nicely grouped as three plots per page, however, when 
> I try to send it to a PostScript file I get one page for each plot.  I 
> have adjusted my postscript options so that my plots are the size that 
> I want and the paper is set to portrait, I just can't figure out how 
> to get all three plots on one page in the postscript file.  I've been 
> through the archives on the list (albeit not exhaustively) and the 
> manuals available on the R site and cannot figure out how to solve my 
> problem.
> Thanks,
> -Heather

Either one of the following work for me:

# Do 3 plots in a 2 x 2 matrix
postscript(file = "ThreePlots.ps", horizontal = FALSE) par(mfrow = c(2, 2))

# Do 3 x 1
postscript(file = "ThreePlots.ps", horizontal = FALSE) par(mfrow = c(3, 1))

Can you provide an example of the code that you are using?

Marc Schwartz

More information about the R-help mailing list