-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug
Milestone
Description
Bug report
Bug summary
Providing ax.scatter()
with coordinates containing np.nan
fails when providing edgecolor
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
import matplotlib.pyplot as plt
import numpy as np
fig, 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 specifying edgecolor
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.For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug