@@ -4281,19 +4281,26 @@ def invalid_shape_exception(csize, xsize):
42814281 except ValueError :
42824282 pass # Failed to convert to float array; must be color specs.
42834283 else :
4284+ # handle the documented special case of a 2D array with 1
4285+ # row which as RGB(A) to broadcast.
4286+ if c .shape == (1 , 4 ) or c .shape == (1 , 3 ):
4287+ c_is_mapped = False
4288+ if c .size != xsize :
4289+ valid_shape = False
42844290 # If c can be either mapped values or a RGB(A) color, prefer
42854291 # the former if shapes match, the latter otherwise.
4286- if c .size == xsize :
4292+ elif c .size == xsize :
42874293 c = c .ravel ()
42884294 c_is_mapped = True
42894295 else : # Wrong size; it must not be intended for mapping.
42904296 if c .shape in ((3 ,), (4 ,)):
42914297 _log .warning (
4292- "'c' argument looks like a single numeric RGB or "
4298+ "*c* argument looks like a single numeric RGB or "
42934299 "RGBA sequence, which should be avoided as value-"
42944300 "mapping will have precedence in case its length "
4295- "matches with 'x' & 'y'. Please use a 2-D array "
4296- "with a single row if you really want to specify "
4301+ "matches with *x* & *y*. Please use the *color* "
4302+ "keyword-argument or provide a 2-D array "
4303+ "with a single row if you intend to specify "
42974304 "the same RGB or RGBA value for all points." )
42984305 valid_shape = False
42994306 if not c_is_mapped :
@@ -4340,14 +4347,14 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
43404347 The marker size in points**2.
43414348 Default is ``rcParams['lines.markersize'] ** 2``.
43424349
4343- c : color or list of colors or array-like , optional
4344- The marker color . Possible values:
4350+ c : array-like or list of colors or color , optional
4351+ The marker colors . Possible values:
43454352
4346- - A single color format string.
4347- - A sequence of colors of length n.
43484353 - A scalar or sequence of n numbers to be mapped to colors using
43494354 *cmap* and *norm*.
43504355 - A 2-D array in which the rows are RGB or RGBA.
4356+ - A sequence of colors of length n.
4357+ - A single color format string.
43514358
43524359 Note that *c* should not be a single numeric RGB or RGBA sequence
43534360 because that is indistinguishable from an array of values to be
@@ -4356,9 +4363,12 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
43564363 matching will have precedence in case of a size matching with *x*
43574364 and *y*.
43584365
4359- Defaults to ``None``. In that case the marker color is determined
4360- by the value of ``color``, ``facecolor`` or ``facecolors``. In case
4361- those are not specified or ``None``, the marker color is determined
4366+ If you wish to specify a single color for all points
4367+ prefer the *color* keyword argument.
4368+
4369+ Defaults to `None`. In that case the marker color is determined
4370+ by the value of *color*, *facecolor* or *facecolors*. In case
4371+ those are not specified or `None`, the marker color is determined
43624372 by the next color of the ``Axes``' current "shape and fill" color
43634373 cycle. This cycle defaults to :rc:`axes.prop_cycle`.
43644374
0 commit comments