Skip to content

Commit

Permalink
change death rate graph to something more meaningful
Browse files Browse the repository at this point in the history
  • Loading branch information
gluap committed Oct 19, 2020
1 parent b873e80 commit 553b414
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions covid_micro/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,17 +425,17 @@ def plot_deathrate_vs_detection(country):
matplotlib.pyplot.close(fig)
return bio.getvalue()


def plot_deaths_per_confirmed(country):
country_data_deaths, country_data_recovered, country_data, log_y_data, x, x_data = timeseries_data(country)

# fig = matplotlib.pyplot.figure(figsize=(5, 5), dpi=300)
fig = matplotlib.pyplot.figure(dpi=300)
ax = fig.add_subplot()

ax.plot(x, country_data_deaths / country_data, "b.", label="deaths/confirmed cases")
ax.plot(x[7+15:], (country_data_deaths[15+7:]-country_data_deaths[15:-7]) / (country_data[7:-15]-country_data[:-7-15]), "b.",
label="deaths in 7d (now)/ newly infected in 7d (15 days ago)")

ax.plot(x[-1:], country_data_deaths[-1:] / country_data[-1:], marker="+", color="black")
#ax.plot(x[-1:], country_data_deaths[-1:] / country_data[-1:], marker="+", color="black")
matplotlib.pyplot.setp(ax.get_xticklabels(), rotation=25, ha="right", rotation_mode="anchor")
ax.grid(True, which="major")
ax.grid(True, which="minor", linewidth=0.5)
Expand All @@ -444,6 +444,7 @@ def plot_deaths_per_confirmed(country):
ax.legend(loc=2)

ax.set_xlim((x[0], x[-1]))
ax.set_ylim((0,0.2))

ax.set_ylabel(f"deaths / confirmed cases")

Expand Down

0 comments on commit 553b414

Please sign in to comment.