You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I attempt to make a contour plot with data that is entirely below the lowest level, and the data has a field of zeros around it, I get an unexpected contour between the zeros and anything positive.
I've confirmed that this is a bug. If the levels for a line contour plot are all outside of the z limits, the levels are replaced by the lower z limit, here:
Under most circumstances we'd get away with this behaviour. However, if there is a quad which has the lower-z value on 3 of its 4 corners then half the area of the quad is at the lower level and the contour line is calculated on the upper edge of this triangle (see #19691 for detailed explanation).
I presume that if the user specifies the contour levels then we should not modify them, even if this means that no contour lines are plotted. But I suspect there may be issues about colorbars being displayed without any contents?
Thanks @ianthomas23 for taking a look at this and providing an explanation. With this knowledge we can make a simple workaround in the user code by setting a new, artificial, localised minimum before plotting. E.g.
Bug report
Bug summary
If I attempt to make a contour plot with data that is entirely below the lowest level, and the data has a field of zeros around it, I get an unexpected contour between the zeros and anything positive.
Code for reproduction
Actual outcome
Expected outcome
The plot should be blank, which is what happens if the call to
np.place
is skipped.Matplotlib version
import matplotlib; print(matplotlib.__version__)
): 3.4.1print(matplotlib.get_backend())
): Qt5AggThe text was updated successfully, but these errors were encountered: