Makie - plotting Nanoseconds with custom tick labels

I’m trying to scatter an array of Nanosecond values, all on the order of 100ms±50us. When I plot these, I get y tick labels like 10.005cs. Is there some way to get tick labels like 100.05ms instead? I tried to use ytickformat to customize this, but no matter what I did, this ended up as 100.05mscs, so with an additional centisecond text that shouldn’t be there..

Thanks!

1 Like

I have the same issue with length units. Plots where I pass “m” units become “dam = 10m” which is a length unit no one uses in practice.

This should get much better after: Improve dim converts recipe compatibility, usability by ffreyer · Pull Request #5323 · MakieOrg/Makie.jl · GitHub

2 Likes

Thanks, that looks very promising! Is there something I can use until that is merged?

There’s an example in the UnitfulConversion docstring:

uc = Makie.UnitfulConversion(u"m"; units_in_label=false)
scatter(1:4, [0.01u"km", 0.02u"km", 0.03u"km", 0.04u"km"]; axis=(dim2_conversion=uc, ylabel="y (m)"))

I think that should do it!

Ah, I’m not using Unitful, but the regular Dates stdlib :sweat_smile: Maybe I should switch..