Stream: helpdesk (published)

Topic: Makie vspans with time axis


view this post on Zulip dzɔn (May 16 2025 at 09:22):

Does anyone know how one could use vspan with an x time axis?

The closest I can get is by converting the time data into unix (integer) and plotting that, but then converting it into xticks seems impossible to do with time axes (and I also want the time axis to adapt when zooming in)

f = Figure()
ax = Axis(f[1,1])

xs = DateTime(2020,1,1):Hour(1):DateTime(2020,1,2)
xs_unix = datetime2unix.(xs)
ys = 1:25

scatter!(ax, xs_unix, ys)
vspan!(ax, xs_unix[1], xs_unix[10])

view this post on Zulip ederag (May 17 2025 at 12:15):

With xtickformat and Dates.unix2datetime it should be possible to display labels in human-readable form.

Otherwise, the Makie Getting help section states that usage questions are best directed to discourse, so you might have better luck there.


Last updated: Jun 09 2025 at 04:50 UTC