Skip to content

Instantly share code, notes, and snippets.

@clayh53
Created December 7, 2020 21:50
Show Gist options
  • Save clayh53/4503614b60bde34be61a0ceb686fbacc to your computer and use it in GitHub Desktop.
Save clayh53/4503614b60bde34be61a0ceb686fbacc to your computer and use it in GitHub Desktop.
fig,ax = plt.subplots(figsize=(12,6))
ax.plot(df.date,df['deathIncrease'].rolling(window=rolling_avg).mean(),color='red',label='14 day moving average new daily infections')
sns.set()
sns.set_style("whitegrid")
ax.plot(df.date, df['predicted_death'].shift(-lag).rolling(window=rolling_avg).mean(), color="blue",linestyle=":",label='14 day moving average predicted new daily deaths')
plt.xlim([start_date,end_date]) # moves the prediction forward in time to match the lag as a check
leg = ax.legend(loc='center', frameon=False,bbox_to_anchor=(0.5, -0.17))
leg2=ax2.legend(loc='center', frameon=False,bbox_to_anchor=(0.49, -0.22))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment