Skip to content

Instantly share code, notes, and snippets.

@todd-cook
Created March 24, 2020 04:26
Show Gist options
  • Save todd-cook/feddb1d50baa0f2550520a1eeca62e5e to your computer and use it in GitHub Desktop.
Save todd-cook/feddb1d50baa0f2550520a1eeca62e5e to your computer and use it in GitHub Desktop.
Graph Covid-19 cases in US, March
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
dates_infections = {'3/1': 89,
'3/2': 105,
'3/3': 125,
'3/4': 159,
'3/5': 227,
'3/6': 331,
'3/7': 444,
'3/8': 564,
'3/9': 728,
'3/10': 1000,
'3/11': 1267,
'3/12': 1645,
'3/13': 2204,
'3/14': 2826,
'3/15': 3505,
'3/16': 4466,
'3/17': 6135,
'3/18': 8760,
'3/19': 13229,
'3/20': 18763,
'3/21': 25740,
'3/22': 35070}
dates, vals = zip(*dates_infections.items())
vals = list(vals)
plt.figure(figsize=(12, 5))
plt.bar(dates, vals)
plt.title('Covid-19 US infections 3/2 - 3/22')
plt.xlabel('Day')
plt.ylabel('Number of cases')
plt.savefig('Covid-19.US.3.2_3.22.png')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment