[R] Can one aply 'mgp' to individual axis?

Frank E Harrell Jr fharrell at virginia.edu
Tue Apr 16 12:46:05 CEST 2002


A general solution in which mgp.x and mgp.y could be specified in par would be extremely useful as it would allow a myriad of high-level plot functions to be called without change.  Absence of mgp.x or .y would cause a reversion to mgp.  I too have found a frequent need for unequal mgp for x and y.

Frank Harrell

On Tue, 16 Apr 2002 08:38:02 +0100 (BST)
ripley at stats.ox.ac.uk wrote:

> On Tue, 16 Apr 2002, Tobias Hoevekamp wrote:
> 
> > Dear R-wizards!
> >
> > I want to move the axis label of the y-axis a little bit
> > more apart from the border of the plot (otherwise, it would overlap
> > with my horizontal numbering). 'par(mgp(3.5, 1, 0))' does it properly.
> 
> (That's not a valid par call.)
> 
> > Unfortunately, it also moves the x-axis label which does not look good.
> >
> > Is there a way to specify 'mgp' for each axis separately or
> > is there another way to move just the y-axis label on its own?
> >
> > Thanks for looking into my problem. I hope there is a solution to it :-)
> 
> Use ylab="" in your main call to plot(), and place the ylabel subsequently
> via a call such as title(ylab = "foo", mgp = c(3.5, 1, 0)).
> Alternatively, use mtext to place the label exactly where you want it.
> 
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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