Closed
Description
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
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?
Matplotlib version
- Operating system: Mojave
- Matplotlib version: 3.0.2
- Matplotlib backend (
print(matplotlib.get_backend())
): - Python version:
- Jupyter version (if applicable):
- Other libraries:
I installed with conda
Metadata
Metadata
Assignees
Labels
No labels