@@ -4490,6 +4490,10 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
4490
4490
"s must be a scalar, "
4491
4491
"or float array-like with the same size as x and y" )
4492
4492
4493
+ # get the original edgecolor the user passed before we normalize
4494
+ orig_edgecolor = edgecolors
4495
+ if edgecolors is None :
4496
+ orig_edgecolor = kwargs .get ('edgecolor' , None )
4493
4497
c , colors , edgecolors = \
4494
4498
self ._parse_scatter_color_args (
4495
4499
c , edgecolors , kwargs , x .size ,
@@ -4518,6 +4522,36 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
4518
4522
path = marker_obj .get_path ().transformed (
4519
4523
marker_obj .get_transform ())
4520
4524
if not marker_obj .is_filled ():
4525
+ if orig_edgecolor is not None :
4526
+ _api .warn_external (
4527
+ f"You passed a edgecolor/edgecolors ({ orig_edgecolor !r} ) "
4528
+ f"for an unfilled marker ({ marker !r} ). Matplotlib is "
4529
+ "ignoring the edgecolor in favor of the facecolor. This "
4530
+ "behavior may change in the future."
4531
+ )
4532
+ # We need to handle markers that can not be filled (like
4533
+ # '+' and 'x') differently than markers that can be
4534
+ # filled, but have their fillstyle set to 'none'. This is
4535
+ # to get:
4536
+ #
4537
+ # - respecting the fillestyle if set
4538
+ # - maintaining back-compatibility for querying the facecolor of
4539
+ # the un-fillable markers.
4540
+ #
4541
+ # While not an ideal situation, but is better than the
4542
+ # alternatives.
4543
+ if marker_obj .get_fillstyle () == 'none' :
4544
+ # promote the facecolor to be the edgecolor
4545
+ edgecolors = colors
4546
+ # set the facecolor to 'none' (at the last chance) because
4547
+ # we can not not fill a path if the facecolor is non-null.
4548
+ # (which is defendable at the renderer level)
4549
+ colors = 'none'
4550
+ else :
4551
+ # if we are not nulling the face color we can do this
4552
+ # simpler
4553
+ edgecolors = 'face'
4554
+
4521
4555
if linewidths is None :
4522
4556
linewidths = rcParams ['lines.linewidth' ]
4523
4557
elif np .iterable (linewidths ):
@@ -4529,8 +4563,8 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
4529
4563
4530
4564
collection = mcoll .PathCollection (
4531
4565
(path ,), scales ,
4532
- facecolors = colors if marker_obj . is_filled () else 'none' ,
4533
- edgecolors = edgecolors if marker_obj . is_filled () else colors ,
4566
+ facecolors = colors ,
4567
+ edgecolors = edgecolors ,
4534
4568
linewidths = linewidths ,
4535
4569
offsets = offsets ,
4536
4570
transOffset = kwargs .pop ('transform' , self .transData ),
0 commit comments