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

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Tue Apr 16 09:38:02 CEST 2002


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list