Plotting timeseries

I have 96 samples at 15 minute intervals. I’d like to plot this with a marker for each sample and the x axis to be appropriate for my sample times (00:00, 00:15,…) although not comprehensive.

using Dates
using Plots
y = rand(96)
x = Dates.Time("00:00"):Dates.Minute(15):Dates.Time("23:45")
plot(x, y, marker=:x)

This gives
Screenshot 2022-08-30 at 09.45.50
where the x axis is confusing. How can I make it show 06:00:00, 12:00:00…?

This feels like it should be something trivial, so I presume I’m missing an obvious trick.

I have also tried TimeSeries.jl (data = TimeArray(x,y); plot(data)) but this gives the same result, presumably as it is the same plotting code.

Just provide the ticks you want:

julia> plot(x, y, marker=:x, xticks = Time("00:00"):Hour(6):Time("23:45"))
1 Like