I have the following code:
using Plots
using TimeSeries
apple_ta = readtimearray("apple.csv")
p = plot(apple_ta[:Open])
Plots.xticks(p)
1-element Vector{Tuple{Vector{Float64}, Vector{String}}}:
([735599.0, 736330.0, 737060.0, 737791.0], ["2015-01-01", "2017-01-01", "2019-01-01", "2021-01-01"])
When I print the xticks, I get the above output but have no idea where values like 735599 are from. First, I thought they must be timestamps of the dates from the XAxis but they aren't. Where do they come from?
My final goal is to be able to set the xticks with xticks!
function to whichever dates I want. Does anybody know how to?
PS. Here is the top 5 lines of apple.csv:
Date,Open,Close,Volume
2015-01-02,27.84749984741211,27.332500457763672,212818400
2015-01-05,27.072500228881836,26.5625,257142000
2015-01-06,26.635000228881836,26.565000534057617,263188400
2015-01-07,26.799999237060547,26.9375,160423600
2015-01-08,27.3075008392334,27.97249984741211,237458000
To answer your question directly,
Dates.value(::Date)
returns the number of days since December 31st, year 0:However it seems to me that something is off with your
TimeArray
- there's a plot recipe inTimeSeries
for plotting data with correctly formatted xticks, here's an MWE using the data you provided:This produces:
Slightly less than ideal cropping on the right hand side, but this can be fixed by either adding
right_margin = 5Plots.mm
or rotating the xticks viaxrot = 30
(or some other value).Are you maybe on some outdated version of
TimeSeries
orPlots
? Here are the versions used to produce the above: