somewhereondearth wrote:
Hi, i have a data with values against time and date. for plotting against date
i used axis.Date() option. but I need a 24hr time plot as well. i have
extracted and plotted, but not being able to put the time ticks ( eg. 6am, 7
am etc) on the x-axis. Im new to R, any help would be appreciated!!
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

______________________________________________
[email protected] 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.

Reply via email to