Core¶
cook_tmap(colors_or_cmap, num_colors=None, reverse=False, name=None, hue=None, saturation=None, value=None, bad=None, under=None, over=None, from_color_model=None)
¶
Cook a completely new colormap or modify an existing one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
colors_or_cmap
|
Sequence | str | Colormap
|
A list of colors or a colormap instance or string. |
required |
num_colors
|
int | None
|
Number of colors in the colormap. Defaults to None. |
None
|
reverse
|
bool
|
Whether to reverse the colormap. Defaults to False. |
False
|
name
|
str | None
|
Name of the colormap; if provided, registers the cmap. Defaults to None. |
None
|
hue
|
float | None
|
Hue factor (-255 to 255) to tweak by. |
None
|
saturation
|
float | None
|
Saturation factor (-10 to 10) to tweak by. |
None
|
value
|
float | None
|
Brightness value factor (0, 3) to tweak by. |
None
|
bad
|
str | None
|
Color for bad values. Defaults to None. |
None
|
under
|
str | None
|
Color for underflow values. Defaults to None. |
None
|
over
|
str | None
|
Color for overflow values. Defaults to None. |
None
|
from_color_model
|
ColorModel | str | None
|
Color model of the input colormap; required if colors_or_cmap is an Sequence and not hexcodes. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
TastyMap |
TastyMap
|
A new TastyMap instance with the new colormap. |
Source code in tastymap/core.py
pair_tbar(plot, colors_or_cmap_or_tmap, bounds, labels=None, uniform_spacing=True, **tbar_kwargs)
¶
Create a custom colorbar for a plot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
plot
|
Any
|
A matplotlib or HoloViews plot. |
required |
colors_or_cmap_or_tmap
|
Sequence | str | Colormap | TastyMap
|
A list of colors or a colormap instance or string. |
required |
bounds
|
slice | Sequence[float]
|
Bounds of the colorbar. |
required |
labels
|
list[str] | None
|
Labels for the colorbar. |
None
|
uniform_spacing
|
bool
|
Whether to space the colors uniformly. |
True
|
tbar_kwargs
|
dict[str, Any]
|
Keyword arguments for the colorbar. |
{}
|
Returns:
Type | Description |
---|---|
The plot. |