@@ -4013,7 +4013,9 @@ def dopatch(xs, ys, **kwargs):
4013
4013
return dict (whiskers = whiskers , caps = caps , boxes = boxes ,
4014
4014
medians = medians , fliers = fliers , means = means )
4015
4015
4016
- def _parse_scatter_color_args (self , c , edgecolors , kwargs , xshape , yshape ):
4016
+ @staticmethod
4017
+ def _parse_scatter_color_args (c , edgecolors , kwargs , xshape , yshape ,
4018
+ get_next_color_func ):
4017
4019
"""
4018
4020
Helper function to process color related arguments of `.Axes.scatter`.
4019
4021
@@ -4023,7 +4025,7 @@ def _parse_scatter_color_args(self, c, edgecolors, kwargs, xshape, yshape):
4023
4025
- kwargs['facecolors']
4024
4026
- kwargs['facecolor']
4025
4027
- kwargs['color'] (==kwcolor)
4026
- - 'b' if in classic mode else next color from color cycle
4028
+ - 'b' if in classic mode else the result of ``get_next_color_func()``
4027
4029
4028
4030
Argument precedence for edgecolors:
4029
4031
@@ -4044,6 +4046,9 @@ def _parse_scatter_color_args(self, c, edgecolors, kwargs, xshape, yshape):
4044
4046
Note: The dict is modified by this function.
4045
4047
xshape, yshape : tuple of int
4046
4048
The shape of the x and y arrays passed to `.Axes.scatter`.
4049
+ get_next_color_func : callable
4050
+ A callable that returns a color. This color is used as facecolor
4051
+ if no other color is provided.
4047
4052
4048
4053
Returns
4049
4054
-------
@@ -4090,7 +4095,7 @@ def _parse_scatter_color_args(self, c, edgecolors, kwargs, xshape, yshape):
4090
4095
if c is None :
4091
4096
c = (facecolors if facecolors is not None
4092
4097
else "b" if rcParams ['_internal.classic_mode' ]
4093
- else self . _get_patches_for_fill . get_next_color ())
4098
+ else get_next_color_func ())
4094
4099
4095
4100
# After this block, c_array will be None unless
4096
4101
# c is an array for mapping. The potential ambiguity
@@ -4289,8 +4294,9 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
4289
4294
s = np .ma .ravel (s ) # This doesn't have to match x, y in size.
4290
4295
4291
4296
c , colors , edgecolors = \
4292
- self ._parse_scatter_color_args (c , edgecolors , kwargs ,
4293
- xshape , yshape )
4297
+ self ._parse_scatter_color_args (
4298
+ c , edgecolors , kwargs , xshape , yshape ,
4299
+ get_next_color_func = self ._get_patches_for_fill .get_next_color )
4294
4300
4295
4301
# `delete_masked_points` only modifies arguments of the same length as
4296
4302
# `x`.
0 commit comments