gsplot.style.legend_colormap#
Functions
|
Create and display a colormap legend on a specified axis. |
- legend_colormap(ax, cmap='viridis', label=None, num_stripes=8, vmin=0, vmax=1, reverse=False, **kwargs)[source]#
Create and display a colormap legend on a specified axis.
- Parameters:
ax (
Axes
) β The target axis for the legend.cmap (
str
, optional) β The colormap to use for the legend (default is βviridisβ).label (
str | None
, optional) β The label to display for the colormap in the legend (default is None).num_stripes (
int
, optional) β The number of stripes to divide the colormap into (default is 8).vmin (
int | float
, optional) β The minimum value of the colormap (default is 0).vmax (
int | float
, optional) β The maximum value of the colormap (default is 1).reverse (
bool
, optional) β Whether to reverse the colormap (default is False).**kwargs (
Any
) β Additional keyword arguments for configuring the legend.
- Returns:
The created legend object.
- Return type:
Notes
This function binds passed parameters and creates a LegendColormap instance to generate a colormap legend on the specified axis.
Examples
>>> import gsplot as gs >>> gs.legend_colormap( ... ax=ax, ... cmap="plasma", ... label="Example Legend", ... num_stripes=10, ... vmin=0, ... vmax=100, ... reverse=True, ... )