Skip to content

x axis

3 messages · lauren mcdonagh, R. Michael Weylandt, David L Carlson

#
In your plot call, you can use xaxt = "n" to turn off the default x
axis tick marks, then add

axis(1, at  = VARIABLEWHEREYOUWANTTICKMARKS) # If you want ticks at
the x you put in, its just axis(1, at = x)

to get ticks where you want them. There's also a label= argument if
you want them to be labled as something other than the numbers.

Hope this helps,

Michael

On Thu, Oct 13, 2011 at 11:42 AM, lauren mcdonagh
<cleverlollipop at yahoo.ie> wrote:
#
There are lots of options since you did not tell us what you want on the
axis (or what you have tried).

For example if you want more than 6 tick marks/labels, replace xlim=c(0,
3000) with xaxp=c(0, 3000, 12) to get labels every 250 meters instead of
500. Depending on the size of the graph window you may need to add
cex.axis=.8 to reduce the text size to fit the labels in the available
space. Likewise xaxp=c(0, 3000, 3) would reduce the number of labels to
every 1000 meters.


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of R. Michael Weylandt
Sent: Thursday, October 13, 2011 1:17 PM
To: lauren mcdonagh
Cc: r-help at r-project.org
Subject: Re: [R] x axis

In your plot call, you can use xaxt = "n" to turn off the default x
axis tick marks, then add

axis(1, at  = VARIABLEWHEREYOUWANTTICKMARKS) # If you want ticks at
the x you put in, its just axis(1, at = x)

to get ticks where you want them. There's also a label= argument if
you want them to be labled as something other than the numbers.

Hope this helps,

Michael

On Thu, Oct 13, 2011 at 11:42 AM, lauren mcdonagh
<cleverlollipop at yahoo.ie> wrote:
I'm currently finishing a masters project and running out of time to figure
out my problem. I have read and tried the examples on many websites, in your
forums and R Help yet still can't manage to change the x axis. I am using R
2.8.0 on windows.
more difficult. My problem is that I need to change the numbers on the x
axis from the default.
(mg/kg)", xlim = c(0,3000), ylim = c(0,1000), col ="black", pch = 19, sub =
"Lead", font.sub = 2)
Action"), col = c(3,4,2), lty = c(2,3,1), cex = 0.8, lwd = c(1,1,2))
I've tried a few things you've already said to other people with problems
but all I get is error.
I've studied my masters in does not use R).
http://www.R-project.org/posting-guide.html
______________________________________________
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.