Plotting¶
sunburst¶
sunburst
¶
sunburst(graph: ConceptGraph, df: DataFrame, *, value: str = 'count', title: str | None = None, colorscale: str | None = None, color_value: str | None = None, color_by: ColorBy = 'auto', branch_palette: Sequence[str] | None = None, hide_root: bool = True, branchvalues: str = 'total', extra_hover: list[str] | None = None, hover_fmt: dict[str, str] | None = None, layout_kwargs: dict[str, Any] | None = None) -> Figure
Render a sunburst from a ConceptGraph + a metric DataFrame.
| PARAMETER | DESCRIPTION |
|---|---|
graph
|
The ConceptGraph to render.
TYPE:
|
df
|
Tidy DataFrame produced by one of the metric functions. Must be
indexed by
TYPE:
|
value
|
Column used for sector size. Defaults to
TYPE:
|
title
|
Figure title.
TYPE:
|
colorscale
|
Plotly colorscale name (e.g.
TYPE:
|
color_value
|
Column used for color intensity. Defaults to
TYPE:
|
color_by
|
How to colour sectors.
TYPE:
|
branch_palette
|
CSS color sequence used when colouring by branch. Defaults to the Plotly qualitative palette.
TYPE:
|
hide_root
|
When
TYPE:
|
branchvalues
|
Plotly sunburst branchvalues (
TYPE:
|
extra_hover
|
Additional columns to append to the hover tooltip.
TYPE:
|
hover_fmt
|
Per-column
TYPE:
|
layout_kwargs
|
Passed verbatim to
TYPE:
|
Source code in src/concept_graph_xai/plotting/sunburst.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
utilization_map¶
utilization_map
¶
utilization_map(graph: ConceptGraph, df: DataFrame, *, value: str = 'feature_count', used_color: str | None = None, unused_color: str = '#d3d3d3', branch_palette: Sequence[str] | None = None, hide_root: bool = True, title: str | None = None, layout_kwargs: dict[str, Any] | None = None) -> Figure
Render a sunburst where unused branches are grey.
The DataFrame must be the output of
:func:concept_graph_xai.metrics.utilization (it requires the is_used
column). By default sector area encodes feature_count and colour
encodes both branch identity (hue) and is-used status (grey when not used)
— the chart subsumes the standalone sunburst(..., feature_counts(...))
structural view.
| PARAMETER | DESCRIPTION |
|---|---|
used_color
|
If
TYPE:
|
branch_palette
|
Custom palette for branch base hues. Defaults to the Plotly qualitative palette.
TYPE:
|
hide_root
|
When
TYPE:
|
Source code in src/concept_graph_xai/plotting/utilization_map.py
auc_drop_map¶
auc_drop_map
¶
auc_drop_map(graph: ConceptGraph, df: DataFrame, *, value: str = 'auc_drop_mean', size: str = 'feature_count', colorscale: str = 'Reds', hide_root: bool = True, title: str | None = None, layout_kwargs: dict[str, Any] | None = None) -> Figure
Render a sunburst where each concept is colored by its AUC drop.
Sector area uses size (feature count by default), the colour intensity
uses value (mean AUC drop by default). Set hide_root=False to
keep the root sector visible.
Source code in src/concept_graph_xai/plotting/auc_drop_map.py
correlation_block¶
correlation_block
¶
correlation_block(result: CorrelationResult, *, title: str | None = None, show_block_labels: bool = True, annotate_mean_abs: bool = True, colorscale: str = 'RdBu', zmid: float = 0.0, layout_kwargs: dict[str, Any] | None = None) -> Figure
Render a correlation matrix with concept-block separators.
Works on the output of any of :func:feature_correlation,
:func:nullity_correlation, or :func:shap_correlation — they all return
a :class:CorrelationResult.
| PARAMETER | DESCRIPTION |
|---|---|
result
|
Output of one of the correlation metrics.
TYPE:
|
title
|
Figure title.
TYPE:
|
show_block_labels
|
Draw the concept name above each diagonal block.
TYPE:
|
annotate_mean_abs
|
Print
TYPE:
|
colorscale
|
Plotly colorscale name. Default
TYPE:
|
zmid
|
Mid value for the colorscale. Use
TYPE:
|
layout_kwargs
|
Passed verbatim to
TYPE:
|
Source code in src/concept_graph_xai/plotting/correlation_block.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
joint_missing_map¶
joint_missing_map
¶
joint_missing_map(graph: ConceptGraph, df: DataFrame, *, value: str = 'joint_missing_rate', size: str = 'feature_count', colorscale: str = 'Reds', hide_root: bool = True, title: str | None = None, layout_kwargs: dict[str, Any] | None = None) -> Figure
Render a sunburst where each concept is coloured by its joint-missing rate.
The DataFrame must come from :func:joint_missing_rate. Sector size uses
feature_count so the shape matches the existing sunburst plots; colour
intensity uses joint_missing_rate. Set hide_root=False to keep
the root sector visible.
Source code in src/concept_graph_xai/plotting/joint_missing_map.py
coherence_importance_scatter¶
coherence_importance_scatter
¶
coherence_importance_scatter(df: DataFrame, *, only_concepts: bool = True, label_points: bool = True, title: str | None = None, layout_kwargs: dict[str, Any] | None = None) -> Figure
Render the coherence × importance quadrant scatter.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Output of :func:
TYPE:
|
only_concepts
|
Drop rows where
TYPE:
|
label_points
|
Annotate every point with the concept name.
TYPE:
|
Source code in src/concept_graph_xai/plotting/coherence_importance_scatter.py
regulatory_tag_overlay¶
regulatory_tag_overlay
¶
regulatory_tag_overlay(graph: ConceptGraph, df: DataFrame | None = None, *, tag_key: str = 'tag', palette: dict[str, str] | None = None, untagged_color: str = '#dddddd', value: str = 'count', hide_root: bool = True, title: str | None = None, layout_kwargs: dict[str, Any] | None = None) -> Figure
Render a sunburst whose sectors are coloured by a node-metadata tag.
| PARAMETER | DESCRIPTION |
|---|---|
graph
|
ConceptGraph; tag is read from
TYPE:
|
df
|
Optional DataFrame providing the
TYPE:
|
tag_key
|
Metadata key carrying the categorical tag.
TYPE:
|
palette
|
Optional
TYPE:
|
untagged_color
|
Colour for nodes that carry no value under
TYPE:
|
hide_root
|
When
TYPE:
|