Plotting¶
sunburst¶
sunburst
¶
sunburst(graph: ConceptGraph, df: DataFrame, *, value: str = 'count', title: str | None = None, colorscale: str | None = None, color_value: str | None = None, 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:
|
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
utilization_map¶
utilization_map
¶
utilization_map(graph: ConceptGraph, df: DataFrame, *, value: str = 'feature_count', used_color: str = '#1f77b4', unused_color: str = '#d3d3d3', 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).
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', 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).
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 | |
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', 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.
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', 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:
|