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

Appearance settings

Commit 27d829a

Browse filesBrowse files
efiringanntzer
authored andcommitted
Handle invalid positions regardless of the plotinvalid kwarg.
1 parent 0eed25a commit 27d829a
Copy full SHA for 27d829a

File tree

Expand file treeCollapse file tree

1 file changed

+9
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-9
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4314,9 +4314,14 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
43144314
c, edgecolors, kwargs, xshape, yshape,
43154315
get_next_color_func=self._get_patches_for_fill.get_next_color)
43164316

4317-
if plotinvalid is False:
4318-
# `delete_masked_points` only modifies arguments of the same length
4319-
# as `x`.
4317+
if plotinvalid and colors == None:
4318+
# Do full color mapping; don't remove invalid c entries.
4319+
ind = np.arange(len(c))
4320+
x, y, s, ind, colors, edgecolors, linewidths =\
4321+
cbook.delete_masked_points(
4322+
x, y, s, ind, colors, edgecolors, linewidths)
4323+
c = np.ma.masked_invalid(c[ind])
4324+
else:
43204325
x, y, s, c, colors, edgecolors, linewidths =\
43214326
cbook.delete_masked_points(
43224327
x, y, s, c, colors, edgecolors, linewidths)
@@ -4363,12 +4368,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
43634368
if norm is not None and not isinstance(norm, mcolors.Normalize):
43644369
raise ValueError(
43654370
"'norm' must be an instance of 'mcolors.Normalize'")
4366-
4367-
if plotinvalid is False:
4368-
collection.set_array(c)
4369-
else:
4370-
collection.set_array(ma.masked_invalid(c))
4371-
4371+
collection.set_array(c)
43724372
collection.set_cmap(cmap)
43734373
collection.set_norm(norm)
43744374

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.