[R] Distance between axis and x.lab

Marc Schwartz MSchwartz at mn.rr.com
Tue Jan 24 14:23:17 CET 2006


On Tue, 2006-01-24 at 13:25 +0100, Andrej Kastrin wrote:
> Dear R useRs,
> 
> what's the most elegant way to modify distance between x-axis and it's 
> title. I didn't find any parameter to do that...
> 
> Thank's in advance,
> 
> cheers, Andrej

If you just want to move the x axis label and no other annotation, the
easiest way is probably:

 # Draw a plot, set the x axis label to ""
 plot(1:10, xlab = "")

 # Now use mtext() to do the label and move it 
 # away from the axis by using 'line'
 mtext(side = 1, text = "Index", line = 4)


Compare the above to:

  plot(1:10)


Further flexibility is provided by the 'ann', 'axes', 'xaxt' and 'yaxt'
arguments to skip other components of the plot such as titles and axes.

See ?plot.default, ?title, ?axis, ?mtext and ?text for more information.

HTH,

Marc Schwartz




More information about the R-help mailing list