gsplot.cmap_line#
- cmap_line(ax, x, y, values, *, cmap=None, norm=None, props=None, config=None, **kwargs)#
Draw a finite polyline whose segments are mapped through a colormap.
- 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 one-dimensional coordinates and scalar colors.
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 one-dimensional coordinates and scalar colors.
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 one-dimensional coordinates and scalar colors.
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 LineCollection property mapping. linewidths defaults to 1.0 when omitted.
config (Config | None) – Optional immutable configuration for the default colormap.
**kwargs (Any) – Optional direct LineCollection properties (e.g.
linewidths,alpha,zorder). Direct keyword arguments are merged with and take precedence overprops.
- Returns:
One native collection containing all non-zero-length segments.
- Return type:
matplotlib.collections.LineCollection- Raises:
DataError – If data, normalization, target, or properties are invalid.
Examples
>>> import gsplot as gs >>> figure, ax = gs.subplots() >>> collection = gs.cmap_line(ax, [0, 1], [0, 1], [0, 1]) >>> collection.axes is ax True >>> figure.clear()