Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7cabe13

Browse files
committed
Finally, mask linewidths
1 parent ab11d0d commit 7cabe13

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

lib/matplotlib/axes/_axes.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3995,10 +3995,11 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
39953995
else:
39963996
colors = None # use cmap, norm after collection is created
39973997

3998-
# s, c, colors, or edgecolors will be unchanged unless they are the
3999-
# same length as x:
4000-
maskargs = x, y, s, c, colors, edgecolors
4001-
x, y, s, c, colors, edgecolors = cbook.delete_masked_points(*maskargs)
3998+
# Anything in maskargs will be unchanged unless it is the same length
3999+
# as x:
4000+
maskargs = x, y, s, c, colors, edgecolors, linewidths
4001+
x, y, s, c, colors, edgecolors, linewidths =\
4002+
cbook.delete_masked_points(*maskargs)
40024003

40034004
scales = s # Renamed for readability below.
40044005

lib/matplotlib/tests/test_axes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4848,9 +4848,12 @@ def test_scatter_color_masking():
48484848
x = np.array([1, 2, 3])
48494849
y = np.array([1, np.nan, 3])
48504850
colors = np.array(['k', 'w', 'k'])
4851+
linewidths = np.array([1, 2, 3])
48514852
s = plt.scatter(x, y, color=colors)
48524853

48534854
facecolors = s.get_facecolors()
48544855
linecolors = s.get_edgecolors()
4856+
linewidths = s.get_linewidths()
48554857
assert_array_equal(facecolors[1], np.array([0, 0, 0, 1]))
48564858
assert_array_equal(linecolors[1], np.array([0, 0, 0, 1]))
4859+
assert linewidths[1] == 3

0 commit comments

Comments
 (0)