Skip to content

Instantly share code, notes, and snippets.

@ceteri
Created May 31, 2020 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ceteri/f24a39c4c8aefd3879ea4d09bf7940bf to your computer and use it in GitHub Desktop.
Save ceteri/f24a39c4c8aefd3879ea4d09bf7940bf to your computer and use it in GitHub Desktop.
def plot_choropleth (anim_path, date, cv19, cities):
ax = gplt.choropleth(
cv19,
hue="deaths_per_mil",
edgecolor="white",
linewidth=5,
cmap="Reds",
alpha=0.8,
projection=gcrs.AlbersEqualArea(),
figsize=(30, 30)
)
ax = gplt.pointplot(
cities,
hue="POP_2010",
cmap="Greens",
scheme="quantiles",
scale="POP_2010",
limits=(3, 50),
zorder=2,
alpha=0.4,
ax=ax
)
ax.set_title(
f"COVID-19 deaths/million vs. population on {date}",
fontsize=36
)
file_name = str(anim_path / "{}.png".format(date.replace("-", "")))
plt.savefig(file_name, bbox_inches="tight", pad_inches=0.1)
return file_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment