matplotlib 3.5.1

NotesOther ParametersParametersReturnsBackRef
scatter(x, y, s=None, c=None, marker=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, *, edgecolors=None, plotnonfinite=False, data=None, **kwargs)

Notes

Other Parameters

data : indexable object, optional

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

**kwargs : `~matplotlib.collections.Collection` properties

Parameters

x, y : float or array-like, shape (n, )

The data positions.

s : float or array-like, shape (n, ), optional

The marker size in points**2. Default is rcParams['lines.markersize'] ** 2 .

c : array-like or list of colors or color, optional

The marker colors. Possible values:

  • A scalar or sequence of n numbers to be mapped to colors using cmap and norm.

  • A 2D array in which the rows are RGB or RGBA.

  • A sequence of colors of length n.

  • A single color format string.

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:None:`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:None:`None`, the marker color is determined by the next color of the Axes ' current "shape and fill" color cycle. This cycle defaults to axes.prop_cycle .

marker : `~.markers.MarkerStyle`, default: :rc:`scatter.marker`

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.

cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`

A .Colormap instance or registered colormap name. cmap is only used if c is an array of floats.

norm : `~matplotlib.colors.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, vmax : float, default: None

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.

alpha : float, default: None

The alpha blending value, between 0 (transparent) and 1 (opaque).

linewidths : float or array-like, default: :rc:`lines.linewidth`

The linewidth of the marker edges. Note: The default edgecolors is 'face'. You may want to change this as well.

edgecolors : {'face', 'none', *None*} or color or sequence of color, default: :rc:`scatter.edgecolors`

The edge color of the marker. Possible values:

  • 'face': The edge color will always be the same as the face color.

  • 'none': No patch boundary will be drawn.

  • A color or sequence of colors.

For non-filled markers, edgecolors is ignored. Instead, the color is determined like with 'face', i.e. from c, colors, or facecolors.

plotnonfinite : bool, default: False

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 ).

Returns

`~matplotlib.collections.PathCollection`

A scatter plot of y vs. x with varying marker size and/or color.

See Also

plot

To plot scatter plots when markers are identical in size and color.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.spatial._qhull.tsearch scipy.interpolate._interpolate.lagrange matplotlib.pyplot.plot matplotlib.pyplot.gci pandas.plotting._core.PlotAccessor.scatter matplotlib.pyplot.plotting

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/pyplot.py#2802
type: <class 'function'>
Commit: