Increase space between xlab and X axis tick labels

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Increase space between xlab and X axis tick labels

philip_rhoades
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?

Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail:  [hidden email]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Increase space between xlab and X axis tick labels

Jim Lemon
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Increase space between xlab and X axis tick labels

Stephen Ellison
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: [hidden email] [[hidden email]] On Behalf Of Jim Lemon [[hidden email]]
Sent: 25 September 2011 12:07
To: [hidden email]
Cc: [hidden email]
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

______________________________________________
[hidden email] 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}}

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Increase space between xlab and X axis tick labels

Gabor Grothendieck
In reply to this post by philip_rhoades
On Sun, Sep 25, 2011 at 6:54 AM, Philip Rhoades <[hidden email]> 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?
>

Try adjusting mar and mgp:

opar <- par(mar = c(5, 6, 4, 2) + 0.1, no.readonly = TRUE)
plot(0, las = 2, mgp = c(4, 1, 0), ylab = "Y")
par(opar)

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] 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.