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

Function chart_3_retry_dist

demo.py:481–502  ·  view source on GitHub ↗
(attempts_dist, ax)

Source from the content-addressed store, hash-verified

479
480
481def chart_3_retry_dist(attempts_dist, ax):
482 if not attempts_dist:
483 return
484 attempt_nums = sorted(attempts_dist.keys())
485 counts = [attempts_dist[a] for a in attempt_nums]
486 colors = [CHART_COLOR_PASS if a == 1 else CHART_COLOR_ACCENT if a == 2 else CHART_COLOR_FAIL
487 for a in attempt_nums]
488 bars = ax.bar([f"Attempt {a}" for a in attempt_nums], counts,
489 color=colors, width=0.5, edgecolor="white", linewidth=1.5)
490 for bar, val in zip(bars, counts):
491 ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height() + 0.05,
492 str(val), ha="center", va="bottom", fontsize=10,
493 fontweight="bold", color=CHART_COLOR_DARK)
494 ax.set_ylim(0, max(counts) * 1.3)
495 _apply_base_style(ax, "Queries Resolved Per Attempt", "Attempt Number", "Queries Resolved")
496 legend_patches = [
497 mpatches.Patch(color=CHART_COLOR_PASS, label="First attempt success"),
498 mpatches.Patch(color=CHART_COLOR_ACCENT, label="Resolved on retry"),
499 mpatches.Patch(color=CHART_COLOR_FAIL, label="Required 3 attempts"),
500 ]
501 ax.legend(handles=legend_patches, fontsize=8, loc="upper right",
502 framealpha=0.9, edgecolor=CHART_GRID)
503
504
505def chart_4_latency(naive_latencies, cl_latencies, ax):

Callers 1

generate_all_chartsFunction · 0.85

Calls 1

_apply_base_styleFunction · 0.85

Tested by

no test coverage detected