Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contours of discntinuous data #75

Closed
jamblejoe opened this issue May 8, 2023 · 1 comment
Closed

Contours of discntinuous data #75

jamblejoe opened this issue May 8, 2023 · 1 comment

Comments

@jamblejoe
Copy link

Consider the following map with discontinuities on the y-axis. The black lines are the contours with value 0. They clearly are wrong at the discontinuity on the y-axis. Expected would be a horizontal line at y=0. Is this a general drawback of the algorithm are is this an edge case, which is not dealt with yet?

xs = range(-6, 6, length=200)
ys = range(-6, 6, length=200)
zs = [angle((x+im*y)^2) for x in xs, y in ys]

heatmap(xs, ys, zs'; cmap=:autumn1)
cl = Contour.contour(xs,ys,zs, 0.)

xs, ys = coordinates(lines(cl)[1])

plot!(xs, ys; color=:black,lw=5)

The first contour:
image

The second contour looks like this:
image

@darwindarak
Copy link
Collaborator

The algorithm doesn't know about the nature of the function you're trying to contour. It sees values changing sign across the y-axis, and without knowing that it's actually a discontinuity it assumes that the function must be zero along the y-axis. I think this will be the case with any contouring algorithm that just takes in a matrix of numbers.

Maybe we can put in an option where the algorithm will treat value jumps larger than some input parameter as a discontinuity? I'd rather handle cases like this by filtering out the contours lines afterwards, but it's not difficult to add this extra parameter in if there's enough people needing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants