I would suggest using the layout function instead of the mfcol and pin with par. The layout function gives you more control of the size of areas to be plotted to.
-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of ckeme...@metlife.com > Sent: Wednesday, November 24, 2010 12:33 PM > To: r-help@r-project.org > Subject: [R] Par() Variables, Timing, and Resizing > > Hello, R-help, > > Although this is my first post to the mailing list, I have been a > subscriber for a while now, and have found all of the posts to be very > informative in my quest to attempt to master R. Thank you for that in > advance. > > This question involves the use of the par() variables pin, oma, and mar > to > resize "sub-plots" in an output window. I am aware from ?plot that the > use > of these variables is hard to predict due to trying to change the same > underlying variables in different ways and that "those last in the > alphabet will win." However, I would still like to accomplish my goal > > I am trying to but two line graphs in a column stacked vertically. The > lower graph will be much wider due to a greater dispersion of the data. > The upper graph will be much smaller, as the data ranges from, say, 1 > to > -1. Therefore, I would like the graphs to be larger and smaller in > height, > respectively. I attempt to do this with the pin variable of the par() > class. > > Further, as the two graphs are related, I want to put a small or even > no > margin between the two graphs. I manipulate the mar and oma variables > to > this end. > > Sadly, I am not getting the results that I want. > > > > par(mfcol=c(2,1)) # 2 plot window > > par(mar=c(0,4,0,2), oma=c(0,2,0.5,2), pin=c(6,0.5)) # Set all > variables > at once for the upper plot > > plot(1:9) # sample upper plot > > par(pin=c(6,3)) # set window size for 2nd plot > > plot(1:9) # sample lower plot > > This method produces the two box plots of varying heights, but does not > change the margins. > > vs. > > > par(mfcol=c(2,1)) # 2 plot window > > par(pin=c(6,0.5)) # Set window size upper plot > > par(mar=c(0,4,0,2), oma=c(0,2,0.5,2))# Set margins > > plot(1:9) # Sample upper plot > > par(pin=c(6,3)) # Set window size lower plot > > plot(1:9) # Sample lower plot > > On the other hand, this method changes the margins, but does not change > the size of the upper box (the lower box's size is changed). > > Also, by placing the set window size for the upper plot command below > the > other par() call creates results like the first method. > > I think the trick is in calling par() and setting the variables in the > correct order. Or maybe this is simply impossible to do with par() and > I > should look into using a different library. Any insight would be > helpful. > > Thank you for any help, > > Chris Kemendo > > platform i386-pc-mingw32 > arch i386 > os mingw32 > system i386, mingw32 > status > major 2 > minor 12.0 > year 2010 > month 10 > day 15 > svn rev 53317 > language R > version.string R version 2.12.0 (2010-10-15) > > The information contained in this message may be > CONFIDE...{{dropped:5}} > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.