Fix tornado plot

- export pickles at the time of publication and re-publication
- export graphs as well
- easier to reproduce old graphs
black
parent 873b42593f
commit 962b9f5034

Binary file not shown.

@ -51,16 +51,23 @@ Diagrams for:\\
\caption{Scalar relations of SARS-CoV-2\\ \citep{mattern2020, jaque2020}}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{tornado/2020-09-09_tornado_plot.pdf}
\caption{`Phase portrait diagram'\\
Visualisation method from \citet{dorling2020} showing daily number of COVID-19 cases and rate of change in the UK. 22nd Jan. to 09th Sept. 2020. Data from \citet{disease.sh2021}\\(as published)}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{tornado/tornado_plot.pdf}
\caption{`Phase portrait diagram' \citep[visualisation method from][]{dorling2020}, showing daily number of COVID-19 cases and rate of change in the UK. Data from John Hopkins University, Baltimore, USA, via https://disease.sh API (accessed 10 Sept. 2020).}
\caption*{Update with data from 31st March 2021}
\end{figure}
\begin{figure}
\centering
\input{futures_loop/futures.tex}
\caption{Models as an operational part of pandemic production. \citep{chun2015,dinno2007}}
\caption{Model operations in pandemic production\\\citep{chun2015,dinno2007}}
\end{figure}
\eject
@ -69,7 +76,7 @@ Diagrams for:\\
\begin{landscape}
\begin{figure}
\input{wave_loop/wave_loop.tex}
\caption{Propelling mechanism of the pandemic ``wave'' as an operational image.}
\caption{Propelling mechanism of the pandemic ``wave'' as an operational image\\\citep{helmreich2020}}
\end{figure}
\end{landscape}

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -7,9 +7,10 @@ import matplotlib
import json
from scipy import interpolate
import numpy as np
import datetime
# %% Use LaTeX, XXX might not need this
plt.rc('text', usetex=True)
# plt.rc('text', usetex=True)
plt.rc('font', family='serif')
params = {"ytick.color" : "w",
@ -52,12 +53,25 @@ for country_code, country_data in countries.items():
country_data['dataframe'] = df
# %%
# cutoff date
df = df[~(df.index > '2020-09-09')]
# %%
df = pd.read_pickle("2020-09-09_data.pkl")
countries = {
'uk': {'name': 'UK', 'dataframe': df}
}
# %% Plotting
fig, ax = plt.subplots(figsize=cm2inch(15,15))
fig, ax = plt.subplots(figsize=cm2inch(15,18))
for country_code, country_data in countries.items():
df = country_data['dataframe']
df = df
line, = ax.plot(
df['cases_change'],
df['daily_cases_avg'],
@ -66,7 +80,7 @@ for country_code, country_data in countries.items():
df['month'] = df.index.month
df['month_change'] = df['month'].diff()
month_start = df['month_change'] == 1
mar_onwards = df['month'] >= 3
mar_onwards = df['month'] >= 1 # used to be 3 to cut labels in 2020
labeldates = pd.concat([df[month_start & mar_onwards], df.tail(1)])
# date labels
for index, row in labeldates.iterrows():
@ -85,8 +99,8 @@ for country_code, country_data in countries.items():
ax.scatter(row['cases_change'], row['daily_cases_avg'], color='w', s=10)
# Date legend
ax.scatter(1150, 0, color='w', s=10)
ax.annotate('Dates: day/month 2020', xy=(220,12), xycoords='axes points', color='w')
ax.scatter(1250, 0, color='w', s=10)
ax.annotate('Dates: day/month 2020/21', xy=(220,12), xycoords='axes points', color='w')
# Line at x=0
plt.axvline(x=0, c='white', lw=1, ls=':')
# remove frame
@ -101,4 +115,6 @@ ax.set(ylabel="UK Daily COVID-19 Cases", xlabel="Increase or decrease in cases p
plt.savefig('tornado_plot.pdf', transparent=True)
# %%
# %%

Loading…
Cancel
Save