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

Skip to content

Commit 835fdc5

Browse files
authored
Merge pull request #10243 from timhoffm/axes-doc-scatter
improve docstring of Axes.scatter
2 parents f02b34a + 426fc55 commit 835fdc5

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
@@ -3966,74 +3966,74 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
39663966
verts=None, edgecolors=None,
39673967
**kwargs):
39683968
"""
3969-
Make a scatter plot of *x* vs *y*.
3970-
3971-
Marker size is scaled by *s* and marker color is mapped to *c*.
3969+
A scatter plot of *y* vs *x* with varying marker size and/or color.
39723970
39733971
Parameters
39743972
----------
39753973
x, y : array_like, shape (n, )
3976-
Input data
3974+
The data positions.
39773975
39783976
s : scalar or array_like, shape (n, ), optional
3979-
Size in points**2.
3977+
The marker size in points**2.
39803978
Default is ``rcParams['lines.markersize'] ** 2``.
39813979
39823980
c : color, sequence, or sequence of color, optional, default: 'b'
3983-
*c* can be a single color format string, or a sequence of color
3984-
specifications of length `N`, or a sequence of `N` numbers to be
3985-
mapped to colors using the `cmap` and `norm` specified via kwargs
3986-
(see below). Note that `c` should not be a single numeric RGB or
3987-
RGBA sequence because that is indistinguishable from an array of
3988-
values to be colormapped. `c` can be a 2-D array in which the
3989-
rows are RGB or RGBA, however, including the case of a single
3990-
row to specify the same color for all points.
3981+
The marker color. Possible values:
3982+
3983+
- A single color format string.
3984+
- A sequence of color specifications of length n.
3985+
- A sequence of n numbers to be mapped to colors using *cmap* and
3986+
*norm*.
3987+
- A 2-D array in which the rows are RGB or RGBA.
3988+
3989+
Note that *c* should not be a single numeric RGB or RGBA sequence
3990+
because that is indistinguishable from an array of values to be
3991+
colormapped. If you want to specify the same RGB or RGBA value for
3992+
all points, use a 2-D array with a single row.
39913993
39923994
marker : `~matplotlib.markers.MarkerStyle`, optional, default: 'o'
3993-
See `~matplotlib.markers` for more information on the different
3994-
styles of markers scatter supports. *marker* can be either
3995-
an instance of the class or the text shorthand for a particular
3996-
marker.
3995+
The marker style. *marker* can be either an instance of the class
3996+
or the text shorthand for a particular marker.
3997+
See `~matplotlib.markers` for more information marker styles.
39973998
39983999
cmap : `~matplotlib.colors.Colormap`, optional, default: None
3999-
A `~matplotlib.colors.Colormap` instance or registered name.
4000-
*cmap* is only used if *c* is an array of floats. If ``None``,
4001-
defaults to rc ``image.cmap``.
4000+
A `.Colormap` instance or registered colormap name. *cmap* is only
4001+
used if *c* is an array of floats. If ``None``, defaults to rc
4002+
``image.cmap``.
40024003
40034004
norm : `~matplotlib.colors.Normalize`, optional, default: None
4004-
A `~matplotlib.colors.Normalize` instance is used to scale
4005-
luminance data to 0, 1. *norm* is only used if *c* is an array of
4006-
floats. If ``None``, use the default `.colors.Normalize`.
4005+
A `~.Normalize` instance is used to scale luminance data to 0, 1.
4006+
*norm* is only used if *c* is an array of floats. If *None*, use
4007+
the default `.colors.Normalize`.
40074008
40084009
vmin, vmax : scalar, optional, default: None
40094010
*vmin* and *vmax* are used in conjunction with *norm* to normalize
4010-
luminance data. If either are ``None``, the min and max of the
4011-
color array is used. Note if you pass a *norm* instance, your
4012-
settings for *vmin* and *vmax* will be ignored.
4011+
luminance data. If None, the respective min and max of the color
4012+
array is used. *vmin* and *vmax* are ignored if you pass a *norm*
4013+
instance.
40134014
40144015
alpha : scalar, optional, default: None
4015-
The alpha blending value, between 0 (transparent) and 1 (opaque)
4016+
The alpha blending value, between 0 (transparent) and 1 (opaque).
40164017
40174018
linewidths : scalar or array_like, optional, default: None
4018-
If ``None``, defaults to ``(lines.linewidth,)``.
4019+
The linewidth of the marker edges. Note: The default *edgecolors*
4020+
is 'face'. You may want to change this as well.
4021+
If *None*, defaults to rcParams ``lines.linewidth``.
40194022
40204023
verts : sequence of (x, y), optional
4021-
If *marker* is ``None``, these vertices will be used to
4022-
construct the marker. The center of the marker is located
4023-
at (0,0) in normalized units. The overall marker is rescaled
4024-
by *s*.
4025-
4026-
edgecolors : color or sequence of color, optional, default: None
4027-
If ``None``, defaults to 'face'.
4024+
If *marker* is *None*, these vertices will be used to construct
4025+
the marker. The center of the marker is located at (0, 0) in
4026+
normalized units. The overall marker is rescaled by *s*.
40284027
4029-
If 'face', the edge color will always be the same as
4030-
the face color.
4028+
edgecolors : color or sequence of color, optional, default: 'face'
4029+
The edge color of the marker. Possible values:
40314030
4032-
If 'none', the patch boundary will not
4033-
be drawn.
4031+
- 'face': The edge color will always be the same as the face color.
4032+
- 'none': No patch boundary will be drawn.
4033+
- A matplotib color.
40344034
4035-
For non-filled markers, the *edgecolors* kwarg
4036-
is ignored and forced to 'face' internally.
4035+
For non-filled markers, the *edgecolors* kwarg is ignored and
4036+
forced to 'face' internally.
40374037
40384038
Returns
40394039
-------
@@ -4051,14 +4051,14 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
40514051
Notes
40524052
-----
40534053
4054-
* The `plot` function will be faster for scatterplots where markers
4054+
* The `.plot` function will be faster for scatterplots where markers
40554055
don't vary in size or color.
40564056
40574057
* Any or all of *x*, *y*, *s*, and *c* may be masked arrays, in which
40584058
case all masks will be combined and only unmasked points will be
40594059
plotted.
40604060
4061-
Fundamentally, scatter works with 1-D arrays; *x*, *y*, *s*, and *c*
4061+
* Fundamentally, scatter works with 1-D arrays; *x*, *y*, *s*, and *c*
40624062
may be input as 2-D arrays, but within scatter they will be
40634063
flattened. The exception is *c*, which will be flattened only if its
40644064
size matches the size of *x* and *y*.

0 commit comments

Comments
 (0)