Skip to content

Instantly share code, notes, and snippets.

@hrzn
Created August 23, 2022 14:23
Show Gist options
  • Save hrzn/c34be6a946182ee9c8e41a25ce0abd42 to your computer and use it in GitHub Desktop.
Save hrzn/c34be6a946182ee9c8e41a25ce0abd42 to your computer and use it in GitHub Desktop.
def plot_forecast_sums(pred_series):
plt.figure(figsize=(10, 5))
pred_series["Total"].plot(label="total", lw=6, alpha=0.3, color="grey")
sum([pred_series[r] for r in regions]).plot(label="sum of regions")
sum([pred_series[r] for r in reasons]).plot(label="sum of reasons")
sum([pred_series[t] for t in regions_reasons_comps]).plot(
label="sum of (region, reason) series"
)
sum([pred_series[t] for t in regions_reasons_city_comps]).plot(
label="sum of (region, reason, city) series"
)
legend = plt.legend(loc="best", frameon=1)
frame = legend.get_frame()
frame.set_facecolor("white")
plot_forecast_sums(pred)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment