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
import matplotlib.pyplot as plt
x = np.arange(-1, 1, 0.1)
y = np.arange(-1, 1, 0.1)
X, Y = np.meshgrid(x, y)
Z = (1-X)**2 + Y**2 # or some other function
fig, ax = plt.subplots()
CS = ax.contourf(X, Y, Z, levels=10)
The issue is in the _contour_level_args function in contour.py, where self.levels is not none because you're passing levels as a keyword argument, which seems to indicate that levels is parsed strangely?
The code you show runs fine with matplotlib 3.0.2. It would throw an error in matplotlib 2.2.3 though.
See #12762 from this comment downwards, as well as #11917.
As mentionned in #12762, maybe we should care about backporting #11917.
Bug report
https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contourf.html#matplotlib.pyplot.contourf
As per the documentation for contour plots, when you pass "levels" as a keyword argument, it sets an instance attribute which breaks the _contour_level_args function.
Code for reproduction
The issue is in the
_contour_level_args
function in contour.py, where self.levels is not none because you're passing levels as a keyword argument, which seems to indicate that levels is parsed strangely?Matplotlib version
print(matplotlib.get_backend())
):I installed with conda
The text was updated successfully, but these errors were encountered: