refactor
This commit is contained in:
23
death_per_case.py
Normal file
23
death_per_case.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
Plot total deaths per total cases of countries over time on log scale
|
||||
"""
|
||||
import matplotlib.pyplot as pp
|
||||
import numpy as np
|
||||
name="death_per_case"
|
||||
|
||||
def plot(data, countries):
|
||||
for loc in data:
|
||||
if loc not in countries:
|
||||
continue
|
||||
time, new_cases, new_deaths, total_cases, total_deaths = data[loc]
|
||||
|
||||
# death/case
|
||||
pp.figure(name)
|
||||
pp.plot(time, np.array(total_deaths)/np.array(total_cases), label=f"{loc}")
|
||||
|
||||
pp.yscale("log")
|
||||
pp.xticks(rotation=90)
|
||||
pp.legend(frameon=False)
|
||||
pp.tight_layout()
|
||||
|
||||
pp.savefig(name+".png")
|
||||
Reference in New Issue
Block a user