Skip to content
Prev 171265 / 398506 Next

24 hour axis /time plots

somewhereondearth wrote:
Hi somewhereondearth,
I would suggest that you convert your hours into military time 
(0000-2359) and then plot the data without an X axis (xaxt="n"). Then 
add the X axis with the appropriate 12 hour labels:

hr12labels<-c("12AM","2AM",...,"10PM")
axis(1,at=seq(0,2400,by=200),labels=hr12labels)

You can do this with date/time variables, but for a one-off, it may be 
easier to just define the labels you want yourself.

Jim