hiphopsllm.viz

hiphopsllm.viz.plots — matplotlib rendering, for environments without internet.

draw_mermaid_png() posts the diagram to mermaid.ink, so it needs network access. A Kaggle notebook usually has none, and a fault tree that cannot be drawn where the analysis runs is not much use. Everything here is matplotlib only.

Fault trees are drawn with the conventional symbols: a rectangle for an event, the AND gate (flat base, domed top) and OR gate (curved sides rising to a point, concave base) beneath the event they resolve, a circle for a basic event and a diamond for an undeveloped one. Gate symbols also carry their name, so the distinction never rests on shape alone.

Colours are the validated design-system tokens rather than the source notebook’s palette, whose teal/apricot pair fails colour-vision separation (ΔE 5.4 protan, against a floor of 8).

hiphopsllm.viz.plots.TOKENS = {'critical': '#d03b3b', 'good': '#0ca30c', 'grid': '#e1e0d9', 'series': '#2a78d6', 'series_light': '#cde2fb', 'serious': '#ec835a', 'surface': '#fcfcfb', 'text': '#0b0b0b', 'text_secondary': '#52514e', 'warning': '#fab219'}

Design tokens (light surface). Status colours are reserved and always ship with a label, never as the only signal.

hiphopsllm.viz.plots.plot_fault_tree(tree, ax=None, title=None, scale=1.0, label_width=22, show_legend=True, as_tree=True)[source]

Draw a synthesised fault tree with the conventional FTA symbols.

as_tree (default) repeats shared causes so the structure is a strict tree: every subtree is then local and the connectors are plain right angles — an event, its gate beneath it, a bus, and a vertical drop to each input, exactly as a fault tree is normally drawn. Set it to False to draw the synthesised DAG instead, where a shared cause appears once and its edges run across the diagram.

Return type:

Any

Parameters:
hiphopsllm.viz.plots.plot_architecture(system, ax=None, title=None, show_ports=False)[source]

Draw the LangGraph architecture — the offline equivalent of display(Image(graph.get_graph().draw_mermaid_png())).

Feedback edges are drawn dashed in the reserved critical colour and labelled, because they are the reason the graph cannot be read as a fault tree until they are removed.

Return type:

Any

Parameters:
hiphopsllm.viz.plots.plot_importance(analysis, top_n=12, ax=None, title=None)[source]

Fussell-Vesely contribution per basic event, ranked.

One measure, one hue. Single points of failure are marked with the reserved critical colour and a “single point” tag, so the distinction never rests on colour alone.

Return type:

Any

Parameters:
hiphopsllm.viz.plots.plot_cutset_orders(analyses, ax=None, title='Minimal cut sets by order')[source]

Cut-set count per order, per hazard — how much defence in depth exists.

Order 1 is a single point of failure, so a tall order-1 bar is the finding.

Return type:

Any

Parameters: