Skip to content

Commit 7acb52d

Browse files
committed
Add kwarg processing for aliases and conflicts
1 parent 18cc8bf commit 7acb52d

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3509,7 +3509,7 @@ def dopatch(xs, ys, **kwargs):
35093509
medians=medians, fliers=fliers, means=means)
35103510

35113511
@docstring.dedent_interpd
3512-
def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
3512+
def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None,
35133513
vmin=None, vmax=None, alpha=None, linewidths=None,
35143514
verts=None, edgecolors=None,
35153515
**kwargs):
@@ -3593,6 +3593,32 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
35933593
if not self._hold:
35943594
self.cla()
35953595

3596+
# Process **kwargs to handle aliases, conflicts with explicit kwargs:
3597+
3598+
facecolors = None
3599+
ec = kwargs.pop('edgecolor', None)
3600+
if ec is not None:
3601+
edgecolors = ec
3602+
fc = kwargs.pop('facecolor', None)
3603+
if fc is not None:
3604+
facecolors = fc
3605+
fc = kwargs.pop('facecolors', None)
3606+
if fc is not None:
3607+
facecolors = fc
3608+
# 'color' should be deprecated in scatter, or clearly defined;
3609+
# since it isn't, I am giving it low priority.
3610+
co = kwargs.pop('color', None)
3611+
if co is not None:
3612+
if edgecolors is None:
3613+
edgecolors = co
3614+
if facecolors is None:
3615+
facecolors = co
3616+
if c is None:
3617+
if facecolors is not None:
3618+
c = facecolors
3619+
else:
3620+
c = 'b' # the original default
3621+
35963622
self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
35973623
x = self.convert_xunits(x)
35983624
y = self.convert_yunits(y)

0 commit comments

Comments
 (0)