8000 DOC: tweak wording about c input to scatter · QuLogic/matplotlib@1a56e12 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a56e12

Browse files
committed
DOC: tweak wording about c input to scatter
Encourage user to use the *color* keyword in the case where they have only one color.
1 parent d84f4a7 commit 1a56e12

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4295,11 +4295,12 @@ def invalid_shape_exception(csize, xsize):
42954295
else: # Wrong size; it must not be intended for mapping.
42964296
if c.shape in ((3,), (4,)):
42974297
_log.warning(
4298-
"'c' argument looks like a single numeric RGB or "
4298+
"*c* argument looks like a single numeric RGB or "
42994299
"RGBA sequence, which should be avoided as value-"
43004300
"mapping will have precedence in case its length "
4301-
"matches with 'x' & 'y'. Please use a 2-D array "
4302-
"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 "
43034304
"the same RGB or RGBA value for all points.")
43044305
valid_shape = False
43054306
if not c_is_mapped:
@@ -4346,14 +4347,14 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
43464347
The marker size in points**2.
43474348
Default is ``rcParams['lines.markersize'] ** 2``.
43484349
4349-
c : color or list of colors or array-like, optional
4350-
The marker color. Possible values:
4350+
c : array-like or list of colors or color, optional
4351+
The marker colors. Possible values:
43514352
4352-
- A single color format string.
4353-
- A sequence of colors of length n.
43544353
- A scalar or sequence of n numbers to be mapped to colors using
43554354
*cmap* and *norm*.
43564355
- 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.
43574358
43584359
Note that *c* should not be a single numeric RGB or RGBA sequence
43594360
because that is indistinguishable from an array of values to be
@@ -4362,9 +4363,12 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
43624363
matching will have precedence in case of a size matching with *x*
43634364
and *y*.
43644365
4365-
Defaults to ``None``. In that case the marker color is determined
4366-
by the value of ``color``, ``facecolor`` or ``facecolors``. In case
4367-
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
43684372
by the next color of the ``Axes``' current "shape and fill" color
43694373
cycle. This cycle defaults to :rc:`axes.prop_cycle`.
43704374

0 commit comments

Comments
 (0)
0