Zooming and date axes in Makie

For example, if you have numbers that mean dates somehow, you could do this

struct DateTicks end

function MakieLayout.get_ticks(::DateTicks, ::typeof(identity), ::Makie.Automatic, vmin, vmax)
    mindate, maxdate = convert_numbers_to_dates.((vmin, vmax))
    dates = find_some_date_ticks(mindate, maxdate)
    ticklabels = make_labels(dates)
    tickvalues = convert_dates_to_numbers(dates)
    return tickvalues, ticklabels
end

# and then
lines(datenumbers, values, axis = (; xticks = DateTicks()))
3 Likes