Johnson, Heather
2004-Aug-13 16:28 UTC
[R] Question from Newbie on PostScript and Multiple Plots
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 [[alternative HTML version deleted]]
Marc Schwartz
2004-Aug-13 16:48 UTC
[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, > -HeatherEither 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)) plot(1:5) barplot(1:5) boxplot(rnorm(10)) dev.off() # Do 3 x 1 postscript(file = "ThreePlots.ps", horizontal = FALSE) par(mfrow = c(3, 1)) plot(1:5) barplot(1:5) boxplot(rnorm(10)) dev.off() Can you provide an example of the code that you are using? Marc Schwartz
partha_bagchi@hgsi.com
2004-Aug-13 16:50 UTC
[R] Question from Newbie on PostScript and Multiple Plots
Have you looked at ?par("mfrow") ?
"Johnson, Heather" <hjohnson at cbmi.pitt.edu>
Sent by: r-help-bounces at stat.math.ethz.ch
08/13/2004 12:28 PM
To: "'r-help at lists.R-project.org'" <r-help
at stat.math.ethz.ch>
cc:
Subject: [R] Question from Newbie on PostScript and Multiple
Plots
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
[[alternative HTML version deleted]]
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Johnson, Heather
2004-Aug-13 17:10 UTC
[R] Question from Newbie on PostScript and Multiple Plots
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.
Heather
-----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))
plot(1:5)
barplot(1:5)
boxplot(rnorm(10))
dev.off()
# Do 3 x 1
postscript(file = "ThreePlots.ps", horizontal = FALSE) par(mfrow =
c(3, 1))
plot(1:5)
barplot(1:5)
boxplot(rnorm(10))
dev.off()
Can you provide an example of the code that you are using?
Marc Schwartz