[R] controlling figure dimension/location

Achim Zeileis zeileis at ci.tuwien.ac.at
Wed Mar 13 14:18:53 CET 2002


On Wed, 13 Mar 2002, Bill Simpson wrote:

> 
> 
> On Wed, 13 Mar 2002, Uwe Ligges wrote:
> 
> > "Michael D. Sohn" wrote:
> > > 
> > > I'm making two plots, one on top of the other.  On the upper plot, I do
> > > not print the x-label or the x-tick-label.  To reduce space, I'd like to
> > > keep the white space between the two figures at a minimum.  However, I
> > > can't figure out how to methodically reduce the space while maintaining
> > > the same figure dimensions for both plots.  I could add margin space
> > > below the lower plot and reduce space above the lower plot but that
> > > leaves a bunch of whitespace at the bottom of the figure.  What command
> > > am I missing?
> 
> I too would be greatly interested in being able to do this. For example if
> you have two plots stacked on top of each other, you would have only the
> ticks on the x-axis of the top plot and the full axis labels and title on
> the bottom plot. The size of the two plots must remain the same.
> 
> So far as I know, this is not possible with R. What I have been doing is
> quite unsatisfactory: set the margins to the minimum acceptable. However
> this still leaves too much whitespace between the plots. If you really are
> motivated you can convert the figure from postscript to xfig or tgif
> format then edit manually. Not a great solution...
> 
> pstoedit        convert .ps file to tgif for editing:
>                         pstoedit -f tgif fig1.ps fig1.obj
> 

Well, maybe I don't get the problem, but you certainly have the
possibility to have two (or more) plots with the same axis without wasting
space in between (just like plot.mts() does for example).
Just set that margins to 0 and don't plot the x-axis but for the last
plot. For example you could do:

par(mar = c(0, 5.1, 0, 2.1), oma = c(6, 0, 5, 0), mfrow=c(2,1))
plot(rnorm(100), xaxt="n")
plot(rnorm(100))

The layout then is very similar to that of plot.mts() as in:

plot(ts(cbind(rnorm(100), rnorm(100))), type = "p")
 
I hope this is what you wanted...
Z


> Bill
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list