-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
contour problem 90 degree angle #19691
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
Comments
Hi @mbakker7, you have posted a good clear example. The short answer is that anyone using a dataset that contains a number of adjacent values which exactly match a contour level are likely to be disappointed with the results. The full answer is much longer... You are asking for a red contour line to be drawn at The algorithm is primarily edge-based. It classifies each of the points in your grid as being above or below the contour level. If an edge of a quad has one end above and the other below the contour level, it knows that contour crosses that edge. But 'above' and 'below' the contour level are not sufficient, we have to consider 'equals' the contour level. So for 'above' we use It would be possible to write a new algorithm that better considers the internals of each quad and does something different to just connecting the edges that the contour crosses. The problem then is finding someone willing to do this work and motivating them to do it. But the takeaway message here is not to try to plot narrow contour lines over a region that matches the contour level because you are likely to be disappointed with the results. |
I'll close. Contours are interpolating between data points. If you don't like our interpolation you can always interpolate yourself and pass contour the finer result. |
Thanks for the detailed explanation, ianthomas23. |
Bug report
Bug summary
The contour routine seems to produce strange results when a contour line must make a 90 degree angle. The problem is reproduced by contouring a small array with 3 rows and 5 columns. The value of the array equals zero along row 0 and along column 2 (the middle column). Contouring the 0 value does not follow this column and the first row.
Code for reproduction
Actual outcome
Expected outcome
The red line, which represents the line for which
h=0
should have gone straight down to (2,0) and then make a 90 degree angle at the bottom of the figure. In fact, the entire bottom row of the figure equals 0.Matplotlib version
The text was updated successfully, but these errors were encountered: