[R] x axis labelling
Jim Lemon
jim at bitwrit.com.au
Wed Jul 2 00:30:34 CEST 2014
On Tue, 1 Jul 2014 06:41:52 PM Michael Millar wrote:
> Hi,
>
> I am new to R and am trying to create a graph with Time(24hr) along
the x
> axis. Rather than start at 01.00, I wanted to start at 14.00.
>
> I tried to use the axis(side=1, at=c( )) function but it continues to put
> then in numeric order. Is there another way I can add labels to the x
axis?
>
Hi Michael,
Perhaps this will get you out of trouble.
mmdat<-data.frame(time=paste(c(14:23,0:13),"00",sep=":"),
wind_speed=sample(0:30,24))
plot(mmdat$wind_speed,type="b",xaxt="n",xlab="Time")
axis(1,at=1:24,labels=mmdat$time)
If you want to get more tick labels on the time axis, look at staxlab
(plotrix).
Jim
More information about the R-help
mailing list