increase figure width
This commit is contained in:
10
basics.py
10
basics.py
@@ -4,11 +4,11 @@ Plot total cases of countries over time on log scale
|
|||||||
import matplotlib.pyplot as pp
|
import matplotlib.pyplot as pp
|
||||||
|
|
||||||
def plot(data, countries):
|
def plot(data, countries):
|
||||||
|
figsize = (10,5)
|
||||||
tcp, tc = pp.subplots()
|
tcp, tc = pp.subplots(figsize=figsize)
|
||||||
tdp, td = pp.subplots()
|
tdp, td = pp.subplots(figsize=figsize)
|
||||||
ncp, nc = pp.subplots()
|
ncp, nc = pp.subplots(figsize=figsize)
|
||||||
ndp, nd = pp.subplots()
|
ndp, nd = pp.subplots(figsize=figsize)
|
||||||
for loc in data:
|
for loc in data:
|
||||||
if loc not in countries:
|
if loc not in countries:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ import numpy as np
|
|||||||
name="death_per_case"
|
name="death_per_case"
|
||||||
|
|
||||||
def plot(data, countries):
|
def plot(data, countries):
|
||||||
|
figsize = (10,5)
|
||||||
for loc in data:
|
for loc in data:
|
||||||
if loc not in countries:
|
if loc not in countries:
|
||||||
continue
|
continue
|
||||||
time, new_cases, new_deaths, total_cases, total_deaths = data[loc]
|
time, new_cases, new_deaths, total_cases, total_deaths = data[loc]
|
||||||
|
|
||||||
# death/case
|
# death/case
|
||||||
pp.figure(name)
|
pp.figure(name, figsize=figsize)
|
||||||
pp.plot(time, np.array(total_deaths)/np.array(total_cases), label=f"{loc}", marker=".")
|
pp.plot(time, np.array(total_deaths)/np.array(total_cases), label=f"{loc}", marker=".")
|
||||||
|
|
||||||
pp.yscale("log")
|
pp.yscale("log")
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ import numpy as np
|
|||||||
name="delay"
|
name="delay"
|
||||||
|
|
||||||
def plot(data, countries):
|
def plot(data, countries):
|
||||||
|
figsize = (10,5)
|
||||||
for loc in data:
|
for loc in data:
|
||||||
if loc not in countries:
|
if loc not in countries:
|
||||||
continue
|
continue
|
||||||
time, new_cases, new_deaths, total_cases, total_deaths = data[loc]
|
time, new_cases, new_deaths, total_cases, total_deaths = data[loc]
|
||||||
|
|
||||||
pp.figure(name)
|
pp.figure(name, figsize=figsize)
|
||||||
day_of_above_hundred_cases = np.argwhere(np.array(total_cases) > 100)[0][0]
|
day_of_above_hundred_cases = np.argwhere(np.array(total_cases) > 100)[0][0]
|
||||||
|
|
||||||
new_time_axis = np.arange(len(time)) - day_of_above_hundred_cases
|
new_time_axis = np.arange(len(time)) - day_of_above_hundred_cases
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ import numpy as np
|
|||||||
name="delay"
|
name="delay"
|
||||||
|
|
||||||
def plot(data, countries):
|
def plot(data, countries):
|
||||||
|
figsize = (10,5)
|
||||||
for loc in data:
|
for loc in data:
|
||||||
if loc not in countries:
|
if loc not in countries:
|
||||||
continue
|
continue
|
||||||
time, new_cases, new_deaths, total_cases, total_deaths = data[loc]
|
time, new_cases, new_deaths, total_cases, total_deaths = data[loc]
|
||||||
|
|
||||||
pp.figure(name)
|
pp.figure(name, figsize=figsize)
|
||||||
day_of_above_hundred_cases = np.argwhere(np.array(total_cases) > 100)[0][0]
|
day_of_above_hundred_cases = np.argwhere(np.array(total_cases) > 100)[0][0]
|
||||||
|
|
||||||
new_time_axis = np.arange(len(time)) - day_of_above_hundred_cases
|
new_time_axis = np.arange(len(time)) - day_of_above_hundred_cases
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ import numpy as np
|
|||||||
name="normalized_to_first_death"
|
name="normalized_to_first_death"
|
||||||
|
|
||||||
def plot(data, countries):
|
def plot(data, countries):
|
||||||
|
figsize = (10,5)
|
||||||
for loc in data:
|
for loc in data:
|
||||||
if loc not in countries:
|
if loc not in countries:
|
||||||
continue
|
continue
|
||||||
time, new_cases, new_deaths, total_cases, total_deaths = data[loc]
|
time, new_cases, new_deaths, total_cases, total_deaths = data[loc]
|
||||||
|
|
||||||
pp.figure(name)
|
pp.figure(name, figsize=figsize)
|
||||||
day_of_first_death = np.argwhere(np.array(total_deaths) > 0)[0][0]
|
day_of_first_death = np.argwhere(np.array(total_deaths) > 0)[0][0]
|
||||||
new_time_axis = np.arange(len(time)) - day_of_first_death
|
new_time_axis = np.arange(len(time)) - day_of_first_death
|
||||||
pp.plot(new_time_axis, np.array(total_cases), label=f"{loc}", marker=".")
|
pp.plot(new_time_axis, np.array(total_cases), label=f"{loc}", marker=".")
|
||||||
|
|||||||
Reference in New Issue
Block a user