Browse Source

Fix tornado plot

- export pickles at the time of publication and re-publication
- export graphs as well
- easier to reproduce old graphs
black
parent
commit
962b9f5034
  1. BIN
      main.pdf
  2. 13
      main.tex
  3. BIN
      tornado/2020-09-09_data.pkl
  4. BIN
      tornado/2020-09-09_tornado_plot.pdf
  5. BIN
      tornado/2021-03-31_data.pkl
  6. BIN
      tornado/2021-03-31_tornado_plot.pdf
  7. BIN
      tornado/tornado_plot.pdf
  8. 28
      tornado/tornado_plot.py

BIN
main.pdf

13
main.tex

@ -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}

BIN
tornado/2020-09-09_data.pkl

BIN
tornado/2020-09-09_tornado_plot.pdf

BIN
tornado/2021-03-31_data.pkl

BIN
tornado/2021-03-31_tornado_plot.pdf

BIN
tornado/tornado_plot.pdf

28
tornado/tornado_plot.py

@ -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