[R] Plot time series data irregularly hourly-spaced

arun smartpink111 at yahoo.com
Thu Oct 17 01:00:57 CEST 2013


This may get you started.
testtime1 <- factor(testtime,levels=testtime)

 axis(1,at= as.numeric(testtime1), labels=levels(testtime1)) ## labels are not spaced according to time interval

#Another idea would be: 

testtime2 <- strptime(testtime,"%H:%M:%S")
testtime2[testtime2$hour < 20] <- testtime2[testtime2$hour < 20]+ 24*60*60



On Wednesday, October 16, 2013 6:00 PM, Charles Novaes de Santana <charles.santana at gmail.com> wrote:
Dear all,

I have a time series of data that I would like to represent in a plot. But
I am facing some problems to do it because the time is represented in
"hours", it can start in one day and end in another day, and it is not
regularly spaced.

My problem is that when I plot my data, my X-axis always starts from the
lower values of my time data. For example, I would like to plot data that
starts at 20:00:00 and ends at 01:00:00, but R considers that 01:00:00 is
lower than 21:00:00 and my plot is kind of "crossed over time".

Please try this example to see it graphically:


In this case, I would like to have a plot that starts at 20:00:00 and ends
at 01:00:00.

Does anybody know how to make R understand that 00:00:00 comes after
20:00:00 in this case? Or at least does anybody know a tip to make a plot
with this kind of X-axis?

Thanks for your time and thanks in advance for any help.

Best regards,

Um axé! :)

Charles Novaes de Santana, PhD

    [[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list