Skip to content

Commit db60c1d

Browse files
rootroot
authored andcommitted
Fixed miss matching string on test_scatter_singular_plural_arguments, add reset of linewidths and edgecolors after normalize_kwargs
1 parent 5093491 commit db60c1d

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4552,13 +4552,18 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
45524552
size matches the size of *x* and *y*.
45534553
45544554
"""
4555-
4556-
if edgecolors:
4555+
# add edgecolors and linewidths to kwargs so they
4556+
# can be processed by normailze_kwargs
4557+
if edgecolors is not None:
45574558
kwargs.update({'edgecolors': edgecolors})
4558-
if linewidths:
4559+
if linewidths is not None:
45594560
kwargs.update({'linewidths': linewidths})
45604561

45614562
kwargs = cbook.normalize_kwargs(kwargs, mcoll.Collection)
4563+
# re direct linewidth and edgecolor so it can be
4564+
# further processed by the rest of the function
4565+
linewidths = kwargs.pop('linewidth', None)
4566+
edgecolors = kwargs.pop('edgecolor', None)
45624567
# Process **kwargs to handle aliases, conflicts with explicit kwargs:
45634568
x, y = self._process_unit_info([("x", x), ("y", y)], kwargs)
45644569
# np.ma.ravel yields an ndarray, not a masked array,

lib/matplotlib/tests/test_axes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,19 +2708,19 @@ def test_scatter_singular_plural_arguments(self):
27082708

27092709
with pytest.raises(TypeError,
27102710
match="Got both 'linewidth' and 'linewidths',\
2711-
which are aliases of one another"):
2711+
which are aliases of one another"):
27122712
plt.scatter([1, 2, 3], [1, 2, 3], linewidths=[0.5, 0.4, 0.3], linewidth=0.2)
27132713

27142714
with pytest.raises(TypeError,
27152715
match="Got both 'edgecolor' and 'edgecolors',\
2716-
which are aliases of one another"):
2716+
which are aliases of one another"):
27172717
plt.scatter([1, 2, 3], [1, 2, 3],
27182718
edgecolors=["#ffffff", "#000000", "#f0f0f0"],
27192719
edgecolor="#ffffff")
27202720

27212721
with pytest.raises(TypeError,
27222722
match="Got both 'facecolor' and 'facecolors',\
2723-
which are aliases of one another"):
2723+
which are aliases of one another"):
27242724
plt.scatter([1, 2, 3], [1, 2, 3],
27252725
facecolors=["#ffffff", "#000000", "#f0f0f0"],
27262726
facecolor="#ffffff")

0 commit comments

Comments
 (0)