"""SCI Figure Hub — Publication Additive Ablation Waterfall Chart (CC0-1.0)""" import numpy as np import matplotlib.pyplot as plt PALETTE = ["#3C5488", "#00A087", "#E64B35", "#4DBBD5"] plt.rcParams.update({ "font.family": "sans-serif", "font.sans-serif": ["Arial", "Helvetica", "DejaVu Sans"], "font.size": 8, "axes.linewidth": 0.8, "axes.spines.top": False, "axes.spines.right": False, "pdf.fonttype": 42, }) steps = ["Baseline", "+Doping", "+Defects", "+Co-Cat", "-Loss", "Final (Ours)"] deltas = [62.0, 9.4, 7.2, 11.8, -2.6, 87.8] bottoms = [0.0, 62.0, 71.4, 78.6, 87.8, 0.0] heights = [62.0, 9.4, 7.2, 11.8, 2.6, 87.8] colors = [PALETTE[0], PALETTE[1], PALETTE[1], PALETTE[1], PALETTE[2], PALETTE[3]] fig, ax = plt.subplots(figsize=(4.4, 2.55), dpi=300) xs = np.arange(len(steps)) ax.bar(xs, heights, bottom=bottoms, width=0.56, color=colors, edgecolor="#121C26", lw=0.6) cum = [62.0, 71.4, 78.6, 90.4, 87.8, 87.8] for i in range(len(steps) - 1): ax.plot([xs[i] + 0.28, xs[i + 1] - 0.28], [cum[i], cum[i]], color="#64748B", ls="--", lw=0.75) for xi, b, h, d in zip(xs, bottoms, heights, deltas): lbl = f"{d:+.1f}" if 0 < xi < len(steps) - 1 else f"{d:.1f}" ax.text(xi, b + h + 1.8, lbl, ha="center", va="bottom", fontsize=7.2, fontweight="bold") ax.set_xticks(xs) ax.set_xticklabels(steps, fontsize=7.5) ax.set_ylabel("Efficiency / Score (%)") ax.set_ylim(0, 102) fig.tight_layout() fig.savefig("waterfall_delta.pdf", bbox_inches="tight")