gsplot.cmap_scatter#
- cmap_scatter(ax, x, y, values, *, cmap=None, norm=None, props=None, config=None, **kwargs)#
Create a scalar-colored native scatter collection.
- Parameters:
ax (Axes) – Explicit target Axes.
x (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) – Equal-length finite coordinates and scalar color values.
y (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) – Equal-length finite coordinates and scalar color values.
values (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) – Equal-length finite coordinates and scalar color values.
cmap (str | Colormap | None) – Optional Matplotlib colormap name and normalization specification.
norm (tuple[float, float] | _NormalizeProtocol | None) – Optional Matplotlib colormap name and normalization specification.
props (Mapping[str, Any] | None) – Optional finite PathCollection property mapping. s and alpha default to 1.0 when omitted.
config (Config | None) – Optional immutable configuration for the default colormap.
**kwargs (Any) – Optional direct PathCollection properties. Direct keyword arguments are merged with and take precedence over
props.
- Returns:
The native scalar-colored scatter collection.
- Return type:
matplotlib.collections.PathCollection- Raises:
DataError – If data, normalization, target, or properties are invalid.
Examples
>>> import gsplot as gs >>> figure, ax = gs.subplots() >>> collection = gs.cmap_scatter(ax, [0, 1], [0, 1], [0, 1]) >>> collection.axes is ax True >>> figure.clear()