Bar Charts for Anomalies

Bar Charts for Anomalies#

This section demonstrates how to plot standardized anomalies as bars, with colors depending on sign.

import cmaps
col = cmaps.amwg
positive_color = col.colors[3]  # Example color for positive anomalies
negative_color = col.colors[11]  # Example color for negative anomalies

bar_colors = [positive_color if val >= 0 else negative_color for val in df["CRWS_anom_std"]]

plt.bar(df["Year"], df["CRWS_anom_std"], color=bar_colors)
plt.axhline(0, color="black", linewidth=1)
plt.title("CRWS Standardized Anomalies")
plt.xlabel("Year")
plt.ylabel("Standardized Anomaly")
plt.show()