Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Milestone
Description
Bug summary
The default for the indices keyword in the find_nearest_contour function within countour.py is defined incorrectly in the code. Line 1377 should be "indices = range(len(self.layers))" instead of "indices = range(len(self.levels))."
Code for reproduction
importnumpyasnpimportmatplotlib.pyplotaspltxy=np.indices((100,100))img=np.exp(-np.pi*(np.sum((xy-50)**2,0)/20.**2))cs=plt.contourf(img,50)cs.find_nearest_contour(20,20,pixel=False)
Actual outcome
Traceback (most recent call last):
File "", line 1, in
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/contour.py", line 1388, in find_nearest_contour
con = self.collections[icon]
IndexError: list index out of range
Expected outcome
(0, 0, 397, 23.68976612821045, 14.034856810732212, 49.197307349357025)
Additional information
No response
Operating system
Mac OS 12.3.1
Matplotlib Version
3.5.1
Matplotlib Backend
TkAgg
Python version
3.8.12
Jupyter version
No response
Installation
pip