Skip to content

Instantly share code, notes, and snippets.

@perone
Last active June 5, 2020 19:49
Show Gist options
  • Save perone/5a77187a5baacd9b31c05e7fe8b67a71 to your computer and use it in GitHub Desktop.
Save perone/5a77187a5baacd9b31c05e7fe8b67a71 to your computer and use it in GitHub Desktop.
Gist for the delay plot
# df_delay = Pandas dataframe with data
ax = df_delay.plot.scatter(
title='Symptom Onset vs Confirmation - COVID19 / Rio Grande do Sul / Brazil',
x='DATA_CONFIRMACAO',
y='DATA_SINTOMAS',
alpha=.4,
lw=0,
s=8,
c="Delay (days)",
colormap="Reds_r",
figsize=(7, 5), sharex=False)
for axis in [ax.xaxis, ax.yaxis]:
formatter = mdates.DateFormatter('%d/%m')
locator = mdates.WeekdayLocator(interval=1)
axis.set_major_formatter(formatter)
axis.set_major_locator(locator)
for label in ax.get_xticklabels():
label.set_ha("right")
label.set_rotation(45)
plt.grid(alpha=0.4, zorder=-1000, linestyle=":")
plt.ylabel("Symptom Onset Date")
plt.xlabel("Confirmation Date")
plt.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment