MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.38k stars 302 forks source link

Issue with noisy y-values around constant with autolimits! #4266

Open Zetison opened 2 weeks ago

Zetison commented 2 weeks ago

The following code results in the error "ERROR: ArgumentError: range step cannot be zero". I suggest that in machine epsilon cases like this, one should use the same behavior as if the values were all the same (in this case 4).

using Makie

fig = Figure();
layout = fig[1, 1] = GridLayout()
ax = Axis(layout[1, 1])
x = 1:24
y = ones(size(x))*4
l = lines!(x, y)
y[2] += 1e-15
l[1][] = [Point{2,Float64}(x, y) for (x, y) ∈ zip(x, y)]

autolimits!(ax)
ffreyer commented 2 weeks ago

Maybe we should save-guard against this and #4064 by interpreting a too small limit range as 0 width/height? I.e. if max - min < 100eps(Float64) consider them the same and expand to either side?