MCPcopy Create free account
hub / github.com/Emmimal/control-layer / chart_2_failure_dist

Function chart_2_failure_dist

demo.py:459–478  ·  view source on GitHub ↗
(audit, ax)

Source from the content-addressed store, hash-verified

457
458
459def chart_2_failure_dist(audit, ax):
460 dist = audit.failure_distribution()
461 dist.pop("none", None)
462 if not dist:
463 ax.text(0.5, 0.5, "No failures recorded", ha="center", va="center",
464 transform=ax.transAxes, fontsize=10)
465 ax.set_title("Failure Mode Distribution", fontsize=11, fontweight="bold",
466 color=CHART_COLOR_DARK)
467 return
468 labels = [k.replace("_", "\n") for k in dist.keys()]
469 values = list(dist.values())
470 palette = [CHART_COLOR_FAIL, CHART_COLOR_ACCENT, CHART_COLOR_NEUTRAL, "#E9C46A", "#F4A261"]
471 bars = ax.barh(labels, values, color=palette[:len(labels)], edgecolor="white", linewidth=1.2)
472 for bar, val in zip(bars, values):
473 ax.text(bar.get_width() + 0.05, bar.get_y() + bar.get_height() / 2,
474 str(val), va="center", ha="left", fontsize=9,
475 color=CHART_COLOR_DARK, fontweight="bold")
476 _apply_base_style(ax, "Failure Mode Distribution (All Attempts)", "Count", "")
477 ax.yaxis.grid(False)
478 ax.xaxis.grid(True, color=CHART_GRID, linewidth=0.8, linestyle="--")
479
480
481def chart_3_retry_dist(attempts_dist, ax):

Callers 1

generate_all_chartsFunction · 0.85

Calls 2

_apply_base_styleFunction · 0.85
failure_distributionMethod · 0.80

Tested by

no test coverage detected