Created
May 31, 2020 08:27
-
-
Save ceteri/f24a39c4c8aefd3879ea4d09bf7940bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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