Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 426fc55

Browse files
committed
improve docstring of Axes.scatter
1 parent fd48f3e commit 426fc55

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3951,74 +3951,74 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
39513951
verts=None, edgecolors=None,
39523952
**kwargs):
39533953
"""
3954-
Make a scatter plot of *x* vs *y*.
3955-
3956-
Marker size is scaled by *s* and marker color is mapped to *c*.
3954+
A scatter plot of *y* vs *x* with varying marker size and/or color.
39573955
39583956
Parameters
39593957
----------
39603958
x, y : array_like, shape (n, )
3961-
Input data
3959+
The data positions.
39623960
39633961
s : scalar or array_like, shape (n, ), optional
3964-
Size in points**2.
3962+
The marker size in points**2.
39653963
Default is ``rcParams['lines.markersize'] ** 2``.
39663964
39673965
c : color, sequence, or sequence of color, optional, default: 'b'
3968-
*c* can be a single color format string, or a sequence of color
3969-
specifications of length `N`, or a sequence of `N` numbers to be
3970-
mapped to colors using the `cmap` and `norm` specified via kwargs
3971-
(see below). Note that `c` should not be a single numeric RGB or
3972-
RGBA sequence because that is indistinguishable from an array of
3973-
values to be colormapped. `c` can be a 2-D array in which the
3974-
rows are RGB or RGBA, however, including the case of a single
3975-
row to specify the same color for all points.
3966+
The marker color. Possible values:
3967+
3968+
- A single color format string.
3969+
- A sequence of color specifications of length n.
3970+
- A sequence of n numbers to be mapped to colors using *cmap* and
3971+
*norm*.
3972+
- A 2-D array in which the rows are RGB or RGBA.
3973+
3974+
Note that *c* should not be a single numeric RGB or RGBA sequence
3975+
because that is indistinguishable from an array of values to be
3976+
colormapped. If you want to specify the same RGB or RGBA value for
3977+
all points, use a 2-D array with a single row.
39763978
39773979
marker : `~matplotlib.markers.MarkerStyle`, optional, default: 'o'
3978-
See `~matplotlib.markers` for more information on the different
3979-
styles of markers scatter supports. *marker* can be either
3980-
an instance of the class or the text shorthand for a particular
3981-
marker.
3980+
The marker style. *marker* can be either an instance of the class
3981+
or the text shorthand for a particular marker.
3982+
See `~matplotlib.markers` for more information marker styles.
39823983
39833984
cmap : `~matplotlib.colors.Colormap`, optional, default: None
3984-
A `~matplotlib.colors.Colormap` instance or registered name.
3985-
*cmap* is only used if *c* is an array of floats. If ``None``,
3986-
defaults to rc ``image.cmap``.
3985+
A `.Colormap` instance or registered colormap name. *cmap* is only
3986+
used if *c* is an array of floats. If ``None``, defaults to rc
3987+
``image.cmap``.
39873988
39883989
norm : `~matplotlib.colors.Normalize`, optional, default: None
3989-
A `~matplotlib.colors.Normalize` instance is used to scale
3990-
luminance data to 0, 1. *norm* is only used if *c* is an array of
3991-
floats. If ``None``, use the default `.colors.Normalize`.
3990+
A `~.Normalize` instance is used to scale luminance data to 0, 1.
3991+
*norm* is only used if *c* is an array of floats. If *None*, use
3992+
the default `.colors.Normalize`.
39923993
39933994
vmin, vmax : scalar, optional, default: None
39943995
*vmin* and *vmax* are used in conjunction with *norm* to normalize
3995-
luminance data. If either are ``None``, the min and max of the
3996-
color array is used. Note if you pass a *norm* instance, your
3997-
settings for *vmin* and *vmax* will be ignored.
3996+
luminance data. If None, the respective min and max of the color
3997+
array is used. *vmin* and *vmax* are ignored if you pass a *norm*
3998+
instance.
39983999
39994000
alpha : scalar, optional, default: None
4000-
The alpha blending value, between 0 (transparent) and 1 (opaque)
4001+
The alpha blending value, between 0 (transparent) and 1 (opaque).
40014002
40024003
linewidths : scalar or array_like, optional, default: None
4003-
If ``None``, defaults to ``(lines.linewidth,)``.
4004+
The linewidth of the marker edges. Note: The default *edgecolors*
4005+
is 'face'. You may want to change this as well.
4006+
If *None*, defaults to rcParams ``lines.linewidth``.
40044007
40054008
verts : sequence of (x, y), optional
4006-
If *marker* is ``None``, these vertices will be used to
4007-
construct the marker. The center of the marker is located
4008-
at (0,0) in normalized units. The overall marker is rescaled
4009-
by *s*.
4010-
4011-
edgecolors : color or sequence of color, optional, default: None
4012-
If ``None``, defaults to 'face'.
4009+
If *marker* is *None*, these vertices will be used to construct
4010+
the marker. The center of the marker is located at (0, 0) in
4011+
normalized units. The overall marker is rescaled by *s*.
40134012
4014-
If 'face', the edge color will always be the same as
4015-
the face color.
4013+
edgecolors : color or sequence of color, optional, default: 'face'
4014+
The edge color of the marker. Possible values:
40164015
4017-
If 'none', the patch boundary will not
4018-
be drawn.
4016+
- 'face': The edge color will always be the same as the face color.
4017+
- 'none': No patch boundary will be drawn.
4018+
- A matplotib color.
40194019
4020-
For non-filled markers, the *edgecolors* kwarg
4021-
is ignored and forced to 'face' internally.
4020+
For non-filled markers, the *edgecolors* kwarg is ignored and
4021+
forced to 'face' internally.
40224022
40234023
Returns
40244024
-------
@@ -4036,14 +4036,14 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
40364036
Notes
40374037
-----
40384038
4039-
* The `plot` function will be faster for scatterplots where markers
4039+
* The `.plot` function will be faster for scatterplots where markers
40404040
don't vary in size or color.
40414041
40424042
* Any or all of *x*, *y*, *s*, and *c* may be masked arrays, in which
40434043
case all masks will be combined and only unmasked points will be
40444044
plotted.
40454045
4046-
Fundamentally, scatter works with 1-D arrays; *x*, *y*, *s*, and *c*
4046+
* Fundamentally, scatter works with 1-D arrays; *x*, *y*, *s*, and *c*
40474047
may be input as 2-D arrays, but within scatter they will be
40484048
flattened. The exception is *c*, which will be flattened only if its
40494049
size matches the size of *x* and *y*.

0 commit comments

Comments
 (0)