Makie.jl
Makie.jl copied to clipboard
Overlapping/zombie contour lines
Hey All,
I've recently upgraded to Makie 0.17.7 (GLMakie 0.6.7) from 0.17.3, and I'm noticing contour plots seem to be behaving a bit differently. I've got a contour linked to an observable and it seems like maybe the old lines aren't quite being cleared away or something? See the screenshot below

In my case, the contour is redrawn when data changes with an on(data) do ... end block using delete!(axis, the_contour) + the_contour = contour!(fig, ...).
delete!(axis, the_contour) + the_contour = contour!(fig, ...).
That's incredible inefficient, any reason you need to do it that way?
But I guess that means that delete! is broken...
Btw, with a bug report it's always great to supply a minimal working example that I can execute, to quickly get started looking into the problem. E.g. trying:
f, ax, pl = contour(rand(10, 10)); display(f)
delete!(ax, pl)
Doesn't reproduce the problem, so now I'm left guessing what's going on in your example.
That's incredibly inefficient, any reason you need to do it that way?
The data starts off with 0-1 points, causing errors in contour!. Additionally, the data can drop down to 0-1 points later and so to avoid either showing old contour plots or triggering the error delete! is used.
Btw, with a bug report it's always great to supply a minimal working example that I can execute, to quickly get started looking into the problem.
I try to do quick MWEs, but unfortunately in this case a fair bit of surrounding code is required. I'll see if I can try cutting bits out and playing around with things to make a proper MWE, hopefully in the next few days.
Hm, maybe worth to open an issue about making contours work with 0 points...
I feel like some "if no points, just draw nothing" logic would be sensible. I can open an issue for that :slightly_smiling_face:.
basically all the low level plot objects should support 0 element inputs, I know I've fixed a few. For some higher level ones it's debatable, contour could work
Should I open another issue for colourbars too? I had the same problem with them.