frame-bot / scripts /plot /_plot_comparison.py
httgiang
mega update
e35b73e
Raw
History Blame Contribute Delete
1.42 kB
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np
systems = ["Ours\n(Sonnet + pipeline)", "Claude\n(direct)", "GPT\n(direct)", "Grok\n(direct)"]
mcr = [1.00, 0.85, 0.80, 0.75]
mac = [0.910, 0.640, 0.570, 0.550]
x = np.arange(len(systems))
width = 0.32
fig, ax = plt.subplots(figsize=(8, 5))
bars_mcr = ax.bar(x - width / 2, mcr, width, label="MCR", color="#4C72B0", zorder=3)
bars_mac = ax.bar(x + width / 2, mac, width, label="MAC", color="#DD8452", zorder=3)
ax.set_ylim(0, 1.15)
ax.set_ylabel("Score", fontsize=12)
ax.set_title("NL→UPPAAL Pipeline: System Comparison\n(MCR = compile rate, MAC = mean correct queries)", fontsize=12)
ax.set_xticks(x)
ax.set_xticklabels(systems, fontsize=11)
ax.axhline(1.0, color="gray", linestyle="--", linewidth=0.8, zorder=2)
ax.yaxis.grid(True, linestyle="--", alpha=0.5, zorder=0)
ax.set_axisbelow(True)
ax.legend(fontsize=11)
for bar in bars_mcr:
ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height() + 0.015,
f"{bar.get_height():.2f}", ha="center", va="bottom", fontsize=10, fontweight="bold")
for bar in bars_mac:
ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height() + 0.015,
f"{bar.get_height():.3f}", ha="center", va="bottom", fontsize=10, fontweight="bold")
fig.tight_layout()
out = "docs/comparison_chart.png"
plt.savefig(out, dpi=150)
print(f"Saved -> {out}")
plt.show()