24 lines
607 B
Python
24 lines
607 B
Python
"""
|
|
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}", marker=".")
|
|
|
|
pp.yscale("log")
|
|
pp.xticks(rotation=45)
|
|
pp.legend(frameon=False)
|
|
pp.tight_layout()
|
|
|
|
pp.savefig(name+".png")
|