On Tue, 25 Sep 2001, Winifred Lambert wrote:
> All,
>
> 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.
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.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
|