matplotlib : axes.scatter
Axes.scatter(x, y, s=None, c=None, marker=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, verts=None, edgecolors=None, *, data=None, **kwargs)
Make a scatter plot of x vs y.
画散点图
Marker size is scaled by s and marker color is mapped to c.
标识符的大小由S决定,颜色由C决定
Parameters:
x, y : array_like, shape (n, )
这里的shape是(n,)
s : scalar or array_like, shape (n, ), optional
s:标量活数组,可选
c : color, sequence, or sequence of color, optional, default: ‘b’
c:颜色 默认蓝色,
c can be a single color format string, or a sequence of color specifications of length N, or a sequence of N numbers to be mapped to colors using the cmap and norm specified via kwargs (see below). Note that c should not be a single numeric RGB or RGBA sequence because that is indistinguishable from an array of values to be colormapped. c can be a 2-D array in which the rows are RGB or RGBA, however, including the case of a single row to specify the same color for all points.
marker : MarkerStyle, optional, default: ‘o’
标志风格,可选,默认‘o’
See markers for more information on the different styles of markers scatter supports. marker can be either an instance of the class or the text shorthand for a particular marker.
cmap : Colormap, optional, default: None
颜色c的映射图,可选
A Colormap instance or registered name. cmap is only used if c is an array of floats. If None, defaults to rc image.cmap.
norm : Normalize, optional, default: None
A Normalize instance is used to scale luminance data to 0, 1. norm is only used if c is an array of floats. If None, use the default normalize().
vmin, vmax : scalar, optional, default: None
vmin and vmax are used in conjunction with norm to normalize luminance data. If either are None, the min and max of the color array is used. Note if you pass a norm instance, your settings for vmin and vmax will be ignored.
alpha : scalar, optional, default: None
The alpha blending value, between 0 (transparent) and 1 (opaque)
linewidths : scalar or array_like, optional, default: None
If None, defaults to (lines.linewidth,).
verts : sequence of (x, y), optional
If marker is None, these vertices will be used to construct the marker. The center of the marker is located at (0,0) in normalized units. The overall marker is rescaled by s.
edgecolors : color or sequence of color, optional, default: None
If None, defaults to ‘face’
If ‘face’, the edge color will always be the same as the face color.
If it is ‘none’, the patch boundary will not be drawn.
For non-filled markers, the edgecolors kwarg is ignored and forced to ‘face’ internally.
Returns:
paths : PathCollection
Other Parameters:
**kwargs : Collection properties
See also
plot
to plot scatter plots when markers are identical in size and color
Notes
The plot function will be faster for scatterplots where markers don’t vary in size or color.
Any or all of x, y, s, and c may be masked arrays, in which case all masks will be combined and only unmasked points will be plotted.
Fundamentally, scatter works with 1-D arrays; x, y, s, and c may be input as 2-D arrays, but within scatter they will be flattened. The exception is c, which will be flattened only if its size matches the size of x and y.
Note
In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[]:
All arguments with the following names: ‘c’, ‘color’, ‘edgecolors’, ‘facecolor’, ‘facecolors’, ‘linewidths’, ‘s’, ‘x’, ‘y’.
上一篇: The surface has been released错误原因(亲测有效)
下一篇: 文章标题