Makie does not accept Vector{DataTime} types?

Why doesn’t Makie accept DataTime type, DataTime type is often used.

julia> typeof(e)
Vector{Float64} (alias for Array{Float64, 1})

julia> typeof(time)
Vector{DateTime} (alias for Array{DateTime, 1})

julia> lines(time, e)
ERROR: `Makie.convert_arguments` for the plot type Lines and its conversion trait PointBased() was unsuccessful.

The signature that could not be converted was:
::Vector{DateTime}, ::Vector{Float32}

Makie needs to convert all plot input arguments to types that can be consumed by the backends (typically Arrays with Float32 elements).
You can define a method for `Makie.convert_arguments` (a type recipe) for these types or their supertypes to make this set of arguments convertible (See http://docs.makie.org/stable/documentation/recipes/index.html).    

Alternatively, you can define `Makie.convert_single_argument` for single arguments which have types that are unknown to Makie but which can be converted to known types and fed back to the conversion pipeline.

There is an ongoing effort to make these work by default

3 Likes

Hope for improvement!
I get it using another way with Makie.

f = Figure(; size=(1000, 600))
ax = Axis(f[1, 1];
    xlabel=L"Time",
    ylabel=L"Electric Field (kV/m)",
    title="$(Date(time[1]))",
    xticks=(1:3599:84480, ["$(lpad(hour(time[i]),2,'0'))" * ":" * "$(lpad(minute(time[i]),2,'0'))" * ":" * "$(lpad(second(time[i]),2,'0'))" for i in 1:3599:84480]),
    xticklabelrotation=pi / 4)
lines!(ax, 1:84480, e)
f

Second time I’m making this joke on this forum, but I think this time I’m right:

image

3 Likes