[R] Increase space between xlab and X axis tick labels

S Ellison S.Ellison at LGCGroup.com
Sun Sep 25 18:05:54 CEST 2011


i generally work round this problem by increasing the margins to leave more room for labels ( eg with par( mar=c(6, 4, 4, 2) + 0.1 ) ) and then put axis labels in using something like title(xlab='x axis', line=4). Giving xlab="" in plot() is a simple way of suppressing the default xlab.

You can also use par(omd) to change margin space.

s ellison

________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Jim Lemon [jim at bitwrit.com.au]
Sent: 25 September 2011 12:07
To: phil at pricom.com.au
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Increase space between xlab and X axis tick labels

On 09/25/2011 08:54 PM, Philip Rhoades wrote:
> People,
>
> I am using the "las=2" parameter to rotate the labels for the X axis
> ticks but it means that they are almost touching the "xlab" string. I
> have been messing around with the "mai" paremeter but that doesn't help
> - is there some way of increasing the space between xlab and the X axis
> tick labels?
>
Hi Phil,
Have a look at the "hadj" argument in the "axis" function. Perhaps
setting this to 1 will set the labels in the correct position. If not,
you might have to go to:

# allow display outside the plot region
par(xpd=TRUE)
# plot the labels using the text function
text(...)
# restore plot region clipping
par(xpd=FALSE)

Jim

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list