A scatter plot of y vs. x with varying marker size and/or color.
The data positions.
The marker size in points**2. Default is rcParams['lines.markersize'] ** 2
.
The marker colors. Possible values:
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. If you want to specify the same RGB or RGBA value for all points, use a 2D array with a single row. Otherwise, value- matching will have precedence in case of a size matching with x and y.
If you wish to specify a single color for all points prefer the color keyword argument.
Defaults to None
. In that case the marker color is determined by the value of color, facecolor or facecolors. In case those are not specified or None
, the marker color is determined by the next color of the Axes
' current "shape and fill" color cycle. This cycle defaults to rcParams["axes.prop_cycle"]
(default: cycler('color', ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'])
).
MarkerStyle
, default: rcParams["scatter.marker"]
(default: 'o'
)
The marker style. marker can be either an instance of the class or the text shorthand for a particular marker. See matplotlib.markers
for more information about marker styles.
Colormap
, default: rcParams["image.cmap"]
(default: 'viridis'
)
A Colormap
instance or registered colormap name. cmap is only used if c is an array of floats.
Normalize
, default: None
If c is an array of floats, norm is used to scale the color data, c, in the range 0 to 1, in order to map into the colormap cmap. If None, use the default colors.Normalize
.
vmin and vmax are used in conjunction with the default norm to map the color array c to the colormap cmap. If None, the respective min and max of the color array is used. It is an error to use vmin/vmax when norm is given.
The alpha blending value, between 0 (transparent) and 1 (opaque).
rcParams["lines.linewidth"]
(default: 1.5
)
The linewidth of the marker edges. Note: The default edgecolors is 'face'. You may want to change this as well.
rcParams["scatter.edgecolors"]
(default: 'face'
)
The edge color of the marker. Possible values:
For non-filled markers, edgecolors is ignored. Instead, the color is determined like with 'face', i.e. from c, colors, or facecolors.
Whether to plot points with nonfinite c (i.e. inf
, -inf
or nan
). If True
the points are drawn with the bad colormap color (see Colormap.set_bad
).
If given, the following parameters also accept a string s
, which is interpreted as data[s]
(unless this raises an exception):
x, y, s, linewidths, edgecolors, c, facecolor, facecolors, color
Collection
properties
See also
plot
To plot scatter plots when markers are identical in size and color.
plot
function will be faster for scatterplots where markers don't vary in size or color.matplotlib.axes.Axes.scatter
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.5.1/api/_as_gen/matplotlib.axes.Axes.scatter.html