s-news
[Top] [All Lists]

Summary:Axis Tick Labels

To: "S-PLUS Newsgroup (E-mail)" <s-news@lists.biostat.wustl.edu>
Subject: Summary:Axis Tick Labels
From: Winifred Lambert <lambert.winifred@ensco.com>
Date: Fri, 28 Sep 2001 15:57:59 -0400
Thanks to Dennis Murphy, Nick Ellis, and Professor Ripley for their
prompt and helpful responses.  All of the suggestions led to the desired
product.  The original request follows, then the responses.

S+ 2000, Windows 2000.
I think this is a simple question.  I looked in the on-line archive and
could not find a question like it, so I am turning to the group.  I have
a data frame with multiple columns that I want to create a multi-line
graph from.  Its easy enough to do that.  However, the axis tick labels
are the row numbers, and I would like to use the row names instead.  Is
that possible?  The row names are essentially a time series with times
in 5-minute increments (e.g. ...1245, 1250, 1255, 1300, 1305, ...).
Since the row names are characters, will this cause a problem?  Can I
use the row names directly (I can't find anything that says I can) or
will I have to transform them somehow?  Thanks for the help.

Dennis Murphy:
Can't you coerce the rownames to a numeric vector? Something like
as.numeric(rownames(x))
where x is the object whose rownames are the time series.
I just tried the following and it works:
x <- c(20,16,29,31,27,42,36,33,45)
names(x) <- c("1","2","3","4","5","6","7","8","9")
plot(as.numeric(names(x)),x)

Nick Ellis:
Have a look at tsplot(). If you make your data into time series (using
rts
or as.rts) it should handle the date formatting.

Prof Ripley:
Use plot(..., xaxt="n") followed by a call to axis(1, at, labels).
An example:
library(MASS)
attach(beav2)
plot(1:100, temp, type="l", xaxt="n", xlab="time")
axis(1, at=1:100, labels=time)
Note that axis suppresses labels to make enough space, and you may want
to
make the selection yourself.


Thanks again to all.
*************************************************
Winifred C. Lambert            Senior Scientist/Meteorologist
ENSCO, Inc.
Aerospace Sciences and Engineering Division
1980 N Atlantic Ave, Suite 230
Cocoa Beach, FL  32931
VOICE:  321.853.8130           FAX:  321.853.8415
lambert.winifred@ensco.com

AMU Quarterly Reports are available online:
http://science.ksc.nasa.gov/amu/home.html
*************************************************
 

<Prev in Thread] Current Thread [Next in Thread>
  • Summary:Axis Tick Labels, Winifred Lambert <=