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

scatter() fails on nan-containing input when providing edgecolor #14301

Closed
Assignees
efiring
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug
Milestone
@MaozGelbart

Description

@MaozGelbart

Bug report

Bug summary

Providingax.scatter() with coordinates containingnp.nan fails when providingedgecolor argument (but works when omitting it). Probably related to#12801 and#12422 introduced in 3.1.0, as it runs as expected with 3.0.3.

Code for reproduction

importmatplotlib.pyplotaspltimportnumpyasnpfig,ax=plt.subplots()x= [np.nan]y= [0]c= ['k']ax.scatter(x,y,edgecolor=c)

Actual outcome

Traceback (most recent call last):  File "D:\test.py", line 9, in <module>    ax.scatter(x, y, edgecolor=c)  File "C:\ProgramData\Miniconda3\lib\site-packages\matplotlib\__init__.py", line 1589, in inner    return func(ax, *map(sanitize_sequence, args), **kwargs)  File "C:\ProgramData\Miniconda3\lib\site-packages\matplotlib\axes\_axes.py", line 4490, in scatter    alpha=alpha  File "C:\ProgramData\Miniconda3\lib\site-packages\matplotlib\collections.py", line 883, in __init__    Collection.__init__(self, **kwargs)  File "C:\ProgramData\Miniconda3\lib\site-packages\matplotlib\collections.py", line 128, in __init__    self.set_edgecolor(edgecolors)  File "C:\ProgramData\Miniconda3\lib\site-packages\matplotlib\collections.py", line 728, in set_edgecolor    self._set_edgecolor(c)  File "C:\ProgramData\Miniconda3\lib\site-packages\matplotlib\collections.py", line 712, in _set_edgecolor    self._edgecolors = mcolors.to_rgba_array(c, self._alpha)  File "C:\ProgramData\Miniconda3\lib\site-packages\matplotlib\colors.py", line 286, in to_rgba_array    result[i] = to_rgba(cc, alpha)  File "C:\ProgramData\Miniconda3\lib\site-packages\matplotlib\colors.py", line 177, in to_rgba    rgba = _to_rgba_no_colorcycle(c, alpha)  File "C:\ProgramData\Miniconda3\lib\site-packages\matplotlib\colors.py", line 238, in _to_rgba_no_colorcycle    raise ValueError("Invalid RGBA argument: {!r}".format(orig_c))ValueError: Invalid RGBA argument: masked

Expected outcome
Not to fail (and on this example, draw no points; just like without specifyingedgecolor argument).

Matplotlib version

  • Operating system: Windows
  • Matplotlib version: 3.1.0
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.7.3
  • Jupyter version (if applicable):
  • Other libraries: numpy 1.16.3

Installed from conda-forge.

Metadata

Metadata

Assignees

Labels

Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp