[R] Help needed with plot axis labeling

2011-03-24 Thread Thomas Adams
 I have looked at many examples and tried many different combinations 
of doing this, but with no luck. I have something like this:


plot(1:10, xaxt = n)
axis(1, xaxp=c(2, 9, 7))
axis(4)

but, what I need is to have different labels for axis-4 than those for 
axis-2 (the vertical axes) — that is, rather than 2,4,6,8,10 for both 
the left and right vertical axes, I need A,B,C,D,E on the right — but at 
the same tick locations as those on the left. I have tried using at=1:5, 
labels=c(…), but either nothing happens or I overwrite axis-4 at 
different tick locations; in any case, not what I need. How can I do this?


Regards,
Tom

--
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL:  thomas.ad...@noaa.gov

VOICE:  937-383-0528
FAX:937-383-0033

__
R-help@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.


Re: [R] Help needed with plot axis labeling

2011-03-24 Thread Sarah Goslee
Thomas,

You need to specify both the labels and the desired location:

plot(1:10, xaxt = n)
axis(1, xaxp=c(2, 9, 7))
axis(4, labels=c(A, B, C, D, E), at=seq(2, 10, by=2))

You want the labels at 2,4,6,8,10 so you need to specify that,
not 1:5.

Sarah

On Thu, Mar 24, 2011 at 9:55 AM, Thomas Adams thomas.ad...@noaa.gov wrote:
  I have looked at many examples and tried many different combinations of
 doing this, but with no luck. I have something like this:

 plot(1:10, xaxt = n)
 axis(1, xaxp=c(2, 9, 7))
 axis(4)

 but, what I need is to have different labels for axis-4 than those for
 axis-2 (the vertical axes) — that is, rather than 2,4,6,8,10 for both the
 left and right vertical axes, I need A,B,C,D,E on the right — but at the
 same tick locations as those on the left. I have tried using at=1:5,
 labels=c(…), but either nothing happens or I overwrite axis-4 at different
 tick locations; in any case, not what I need. How can I do this?

 Regards,
 Tom

 --

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@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.