[R] Help with xlab and ylab distance from axes

Marc Schwartz marc_schwartz at comcast.net
Tue Feb 20 17:51:05 CET 2007


On Tue, 2007-02-20 at 11:31 -0500, Michael Kubovy wrote:
> Dear r-helpers,
> 
> In basic graphics, I have a figure with x and y axes suppresed. I  
> would like to move the xlab and the ylab closer to the axes. Do I  
> have to use mtext()?

Michael,

You could set the first value in par("mgp") in the plot() call.  

Compare:

# Default values
plot(1, mgp = c(3, 1, 0), axes = FALSE)

# Move the labels closer
plot(1, mgp = c(1, 1, 0), axes = FALSE)


Changing that value is comparable to changing the 'line' argument in
mtext().

See ?par

HTH,

Marc Schwartz



More information about the R-help mailing list