fig, ax = plt.subplots(figsize=(10, 5)) colors = ["#4a90d9" if v < mean_rev else "#2ecc71" for v in df["revenue_usd"]] ax.bar(df["branch"], df["revenue_usd"] / 1000, color=colors, edgecolor="white", linewidth=0.8) ax.axhline(mean_rev / 1000, color="#e74c3c", linewidth=2, linestyle="--", label=f"Mean: ${mean_rev/1000:.0f}k") ax.axhline(median_rev / 1000, color="#f39c12", linewidth=2, linestyle="-.", label=f"Median: ${median_rev/1000:.0f}k") ax.set_title("Q3 Revenue by Branch with Mean and Median", fontsize=14, fontweight="bold") ax.set_xlabel("Branch") ax.set_ylabel("Revenue (USD thousands)") ax.legend() ax.tick_params(axis="x", rotation=45) plt.tight_layout() plt.savefig("revenue_central_tendency.png", dpi=150) plt.show()