Makie.jl icon indicating copy to clipboard operation
Makie.jl copied to clipboard

Overlapping/zombie contour lines

Open tecosaur opened this issue 3 years ago • 6 comments
trafficstars

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

image

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, ...).

tecosaur avatar Jun 20 '22 04:06 tecosaur

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.

SimonDanisch avatar Jun 20 '22 10:06 SimonDanisch

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.

tecosaur avatar Jun 20 '22 11:06 tecosaur

Hm, maybe worth to open an issue about making contours work with 0 points...

SimonDanisch avatar Jun 20 '22 11:06 SimonDanisch

I feel like some "if no points, just draw nothing" logic would be sensible. I can open an issue for that :slightly_smiling_face:.

tecosaur avatar Jun 20 '22 11:06 tecosaur

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

jkrumbiegel avatar Jun 20 '22 11:06 jkrumbiegel

Should I open another issue for colourbars too? I had the same problem with them.

tecosaur avatar Jun 20 '22 11:06 tecosaur