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]: ax.errorbar raises for all-nan data on matplotlib 3.6.2 #24818

Closed
Milestone
@MaximeLucasSky

Description

@MaximeLucasSky

Bug summary

The functionax.errorbar raises aStopIteration error whenyerr contains onlyNaN values.

Code for reproduction

importmatplotlib.pyplotaspltimportnumpyasnpfig,ax=plt.subplots(1,1)ax.errorbar([0], [0], [np.nan])

Actual outcome

Traceback (most recent call last):  File"<stdin>", line 1,in<module>  File"~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/__init__.py", line 1423,in innerreturn func(ax,*map(sanitize_sequence, args),**kwargs)  File"~.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/axes/_axes.py", line 3488,in errorbar    yerr = _upcast_err(yerr)  File"~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/axes/_axes.py", line 3470,in _upcast_err    isinstance(cbook._safe_first_finite(err), np.ndarray)  File"~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/cbook/__init__.py", line 1749,in _safe_first_finitereturn next(valforvalin objif safe_isfinite(val))StopIteration

Expected outcome

No crash, similar to the case where only some values are NaN.

Additional information

This happens because_upcast_err unconditionally looks for a first finite element inxerr andyerr.

Operating system

Debian

Matplotlib Version

3.6.2

Matplotlib Backend

TkAgg

Python version

3.9.2

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp