I have time in the format of HH:MM:SS. An example is something like this.
data.frame(time=c('08:00:00', '08:10:00'), Y=1:2)
I want to plot it in the x-axis and the corresponding numerical value in the y-axis.
The time can be plotted like the following.
plot(Y ~ I(1:nrow(d)), data = d, axes = FALSE, xlab = "time", type = "b")
axis(side = 2)
axis(side = 1, at = 1:nrow(d), labels = d$time)
But when the time is not uniformly spaced, the plot is still uniformly spaced, which is not ideal.
The above treats the data as a time series. But I don't need the date part (year-month-day).
What is the most succinct way to plot such data with basic graphics command in R?
EDIT:
08:00:00 0
08:05:00 .5
08:10:00 1
08:20:00 2
08:30:00 3
08:40:00 4
08:50:00 5
09:00:00 6
09:10:00 7
I tested plot(Y ~ as.POSIXct(time, format="%H:%M:%S"), data = d)
using the above data. The resulted figure is below. But the default ticks don't make sense. For hours, it should be split in 6 parts instead of 5 parts. How to make it multiple of 6 by default?