tanat.visualization.utils package#
Submodules#
tanat.visualization.utils.color_manager module#
ColorManager: assigns colors to categorical labels.
Accepts a colormap spec (string, dict, or list of hex strings) and a list of labels, then returns a dict mapping each label to a hex color string.
- class tanat.visualization.utils.color_manager.ColorManager[source]#
Bases:
objectAssigns matplotlib colors to categorical labels.
Colormap spec formats: -
str-> named matplotlib colormap (e.g. “tab10”, “Set2”). -dict-> explicit label-to-color mapping. -list[str]-> explicit color cycle; wraps around if more labels than colors. -None-> defaults to “tab10”.- static build(labels: list, spec: str | dict | list | None = None) dict[source]#
Return a
{label: hex_color}dict for every label in labels.- Parameters:
labels – Unique category labels (order determines color assignment when spec is a cmap name or list).
spec – Color specification (see class docstring).
- Returns:
Dict mapping each label to a hex color string.
- Raises:
ValueError – If spec is a dict and some labels are missing.
tanat.visualization.utils.result module#
VisualizationResult: wraps a matplotlib Figure for display and export.
- class tanat.visualization.utils.result.VisualizationResult(fig: Figure)[source]#
Bases:
objectLightweight wrapper around a matplotlib
Figure.Example:
result = visualizer.draw(pool) result.show() result.save("output/barplot.png", dpi=150)
Module contents#
Visualization utilities.
- class tanat.visualization.utils.ColorManager[source]#
Bases:
objectAssigns matplotlib colors to categorical labels.
Colormap spec formats: -
str-> named matplotlib colormap (e.g. “tab10”, “Set2”). -dict-> explicit label-to-color mapping. -list[str]-> explicit color cycle; wraps around if more labels than colors. -None-> defaults to “tab10”.- static build(labels: list, spec: str | dict | list | None = None) dict[source]#
Return a
{label: hex_color}dict for every label in labels.- Parameters:
labels – Unique category labels (order determines color assignment when spec is a cmap name or list).
spec – Color specification (see class docstring).
- Returns:
Dict mapping each label to a hex color string.
- Raises:
ValueError – If spec is a dict and some labels are missing.
- class tanat.visualization.utils.VisualizationResult(fig: Figure)[source]#
Bases:
objectLightweight wrapper around a matplotlib
Figure.Example:
result = visualizer.draw(pool) result.show() result.save("output/barplot.png", dpi=150)