Learned a new trick. thanks! Zech
On Fri, Mar 8, 2013 at 6:41 PM, William Dunlap <wdun...@tibco.com> wrote: > Try using the combination > plot.new() ; par(new=TRUE) > to advance to the next position in the layout before querying par("pin"). > Be sure to actually plot something after the par(new=TRUE). > > E.g., > > layout(matrix(c(1,2,3,4), nrow=2), width=c(1,3), height=c(1,3)) > > plot.new() ; par(new=TRUE) > > par("pin") > [1] 0.6624667 0.1623834 > > plot(10:19, main="One") > > par("pin") > [1] 0.6624667 0.1623834 > > > > plot.new() ; par(new=TRUE) > > par("pin") > [1] 0.6624667 3.5415500 > > plot(20:29, main="Two") > > par("pin") > [1] 0.6624667 3.5415500 > > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > > > -----Original Message----- > > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf > > Of Not To Miss > > Sent: Friday, March 08, 2013 5:12 PM > > To: r-help > > Subject: [R] get current plot dimensions? > > > > Hi R users, > > > > I find par("pin") is kind of confusing (or maybe just me?). The manual > said > > it will give " The current plot dimensions, '(width,height)', in inches." > > The word "current" is the key here. I thought it would give the > dimensions > > of the to-be plot, but it actually gives the dimension of the finished > plot: > > > > > layout(matrix(c(1,2,3,4), nrow=2), width=c(1,3), height=c(1,3)) > > > par("pin") > > [1] 4.216666 3.721324 > > > plot(x) > > > par("pin") > > [1] 0.7194221 0.2223079 > > > plot(x) > > > par("pin") > > [1] 0.7194221 3.7213237 > > > plot(x) > > > par("pin") > > [1] 4.2166662 0.2223079 > > > plot(x) > > > > > > So, if par("pin") doesn't give to-be plot, how can I get its dimension? > > > > Thanks, > > Zech > > > > [[alternative HTML version deleted]] > > [[alternative HTML version deleted]] ______________________________________________ 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.