Skip to content

Commit 0eed25a

Browse files
btang02anntzer
authored andcommitted
Fix for scatter not showing points with valid x/y but invalid color - updated
- Fixed ambiguous kwarg to a more appropriate, less ambiguous name -> plotinvalid
1 parent 6fa8249 commit 0eed25a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4180,7 +4180,7 @@ def _parse_scatter_color_args(c, edgecolors, kwargs, xshape, yshape,
41804180
label_namer="y")
41814181
def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
41824182
vmin=None, vmax=None, alpha=None, linewidths=None,
4183-
verts=None, edgecolors=None, masked=False,
4183+
verts=None, edgecolors=None, plotinvalid=False,
41844184
**kwargs):
41854185
"""
41864186
A scatter plot of *y* vs *x* with varying marker size and/or color.
@@ -4257,7 +4257,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
42574257
For non-filled markers, the *edgecolors* kwarg is ignored and
42584258
forced to 'face' internally.
42594259
4260-
masked : boolean, optional, default: False
4260+
plotinvalid : boolean, optional, default: False
42614261
Set to plot valid points with invalid color, in conjunction with
42624262
`~matplotlib.colors.Colormap.set_bad`.
42634263
@@ -4314,7 +4314,7 @@ 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 masked is False:
4317+
if plotinvalid is False:
43184318
# `delete_masked_points` only modifies arguments of the same length
43194319
# as `x`.
43204320
x, y, s, c, colors, edgecolors, linewidths =\
@@ -4364,7 +4364,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
43644364
raise ValueError(
43654365
"'norm' must be an instance of 'mcolors.Normalize'")
43664366

4367-
if masked is False:
4367+
if plotinvalid is False:
43684368
collection.set_array(c)
43694369
else:
43704370
collection.set_array(ma.masked_invalid(c))

lib/matplotlib/tests/test_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,7 @@ def test_scatter_invalid_color(self, fig_test, fig_ref):
17591759
# stamping fast path, which would result in slightly offset markers.
17601760
ax.scatter(range(4), range(4),
17611761
c=[1, np.nan, 2, np.nan], s=[1, 2, 3, 4],
1762-
cmap=cmap, masked=True)
1762+
cmap=cmap, plotinvalid=True)
17631763
ax = fig_ref.subplots()
17641764
cmap = plt.get_cmap("viridis", 16)
17651765
ax.scatter([0, 2], [0, 2], c=[1, 2], s=[1, 3], cmap=cmap)

0 commit comments

Comments
 (0)