Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: Issue with find_nearest_contour in contour.py #22762

Closed
Labels
Milestone
@jhelmboldt

Description

@jhelmboldt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp