plot infections in all countries

This commit is contained in:
fordprefect
2020-06-24 13:45:27 +02:00
parent 4c38f2b42a
commit 01f9145b76
2 changed files with 31 additions and 97 deletions

31
all_countries.py Normal file
View File

@@ -0,0 +1,31 @@
"""
Plot overview plot for each country separately
"""
import matplotlib.pyplot as pp
import numpy as np
basename="all_"
def plot(data, countries):
figsize = (10,5)
for loc in data:
name = basename+loc
time, new_cases, new_deaths, total_cases, total_deaths = data[loc]
fig, ax1 = pp.subplots(num=name, figsize=figsize)
ax1.plot(time, new_cases, label="raw new cases", color="grey", linestyle="-")
ax1.plot(time[3:-3], np.convolve(new_cases, np.ones((7,))/7, mode="valid"), label="new cases 7day mean", color="orange", linestyle="-", linewidth=2)
ax2 = ax1.twinx()
ax2.plot(time, total_cases, label=f"Total cases", marker="", linestyle="--", color="blue")
#ax1.xticks(rotation=45)
#ax1.set_xlabel("date")
ax1.set_ylabel("new cases")
ax2.set_ylabel("total cases")
fig.legend(frameon=False, loc="upper left", bbox_to_anchor=(0,1), bbox_transform=ax1.transAxes)
pp.title(loc)
fig.tight_layout()
pp.savefig("ac_"+name+".png")
pp.close(fig)

View File

@@ -1,97 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico">
<meta name="robots" content="noindex,nofollow" />
</head>
<body class=body>
<div class=head>
<h3>Visualizations for Corona2020</h3>
</div>
<div class=box>
<h4>Idea</h4>
Everywhere you can see beautiful graphs, but none of them are logarithmic, to better estimate the developement.
So, I made some automatically daily updated plots and put them here.
Not beautiful, but hopefully informing.
Data sourced from <a href=https://ourworldindata.org/coronavirus-source-data>here</a> and is gereneated from the WHO reports.
<details open>
<summary>Basics</summary>
<details open>
<summary>total cases</summary>
<img src=total_cases.png />
</details>
<details open>
<summary>new cases</summary>
<img src=new_cases.png />
</details>
<details open>
<summary>total deaths</summary>
<img src=total_deaths.png />
</details>
<details open>
<summary>new deaths</summary>
<img src=new_deaths.png />
</details>
</details>
<br>
<details open>
<summary>percentual increase</summary>
New cases relative to total cases, with moving average of 3 days.
<img src=percent_increase.png />
</details>
<details open>
<summary>doubling time</summary>
Doubling time with moving average of 3 days.
<img src=doubling_time.png />
</details>
<details open>
<summary>Deaths per cases</summary>
<img src=death_per_case.png />
</details>
<details open>
<summary>Absolute cases timeshifted to day of first reported death</summary>
Warning: data might be incomplete and not start with zero death (e.g. China).
<br>
<img src=normalized_to_first_death.png />
</details>
<details open>
<summary>Absolute cases timeshifted to day of reported infections exceeding 100</summary>
Timeshift to 100 cases, when in most countries the exponential growth fully set in.
<br>
<img src=normalized_to_100_cases.png />
</details>
<details open>
<summary>Delay from China in days</summary>
Delay from case numbers seen in China counted in days
<br>
<img src=delay_china.png />
</details>
<details open>
<summary>Delay from USA in days</summary>
Delay from case numbers seen in USA counted in days
<br>
<img src=delay_usa.png />
</details>
</div>
<div class=foot>
Ein Infoservice von <a href=dukun.de>dukun.de</a>; Suggestions <a href="mailto:&#099;&#111;&#114;&#111;&#110;&#097;&#105;&#110;&#112;&#117;&#116;&#064;&#100;&#117;&#107;&#117;&#110;&#046;&#100;&#101;">by Mail</a>; Proudly made with Python, Matplotlib, Numpy
</div>
</body>
</html>