gsplot.cmap_dash#
- cmap_dash(ax, x, y, values, *, dash=(10.0, 10.0), cmap=None, norm=None, props=None, config=None, **kwargs)#
Draw a colormapped line with a local Matplotlib dash pattern.
The returned tuple contains the one native collection owned by this operation. Keeping the collection whole lets Matplotlib apply dash lengths in display points while preserving one scalar color per segment.
- Parameters:
ax (Axes) – The same explicit target, finite data, normalization, property, and configuration controls as
cmap_line().x (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) – The same explicit target, finite data, normalization, property, and configuration controls as
cmap_line().y (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) – The same explicit target, finite data, normalization, property, and configuration controls as
cmap_line().values (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) – The same explicit target, finite data, normalization, property, and configuration controls as
cmap_line().cmap (str | Colormap | None) – The same explicit target, finite data, normalization, property, and configuration controls as
cmap_line().norm (tuple[float, float] | _NormalizeProtocol | None) – The same explicit target, finite data, normalization, property, and configuration controls as
cmap_line().props (Mapping[str, Any] | None) – The same explicit target, finite data, normalization, property, and configuration controls as
cmap_line().config (Config | None) – The same explicit target, finite data, normalization, property, and configuration controls as
cmap_line().dash (tuple[float, float]) – Two positive display-point lengths for the on and off portions, defaulting to (10.0, 10.0).
**kwargs (Any) – Optional direct LineCollection properties. Direct keyword arguments are merged with and take precedence over
props.
- Returns:
A one-item tuple containing the native dashed collection.
- Return type:
tuple[matplotlib.collections.LineCollection,]- Raises:
DataError – If data, dash, normalization, target, or properties are invalid.
Examples
>>> import gsplot as gs >>> figure, ax = gs.subplots() >>> collections = gs.cmap_dash(ax, [0, 1], [0, 1], [0, 1], dash=(4, 2)) >>> len(collections) 1 >>> figure.clear()