Last active
May 26, 2020 08:46
-
-
Save barrysmyth/f2e3b765302868dd4048f1b985706c07 to your computer and use it in GitHub Desktop.
This file contains 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
# Use the coolwarm colour map, which comes with Matplotlib. | |
cmap = plt.cm.coolwarm | |
# Normalise the log-deaths into a 0, 1 scale | |
norm = colors.Normalize(vmin=deaths.min(), vmax=deaths.max()) | |
# Now the ith colour in colours corresponds to the ith country in deaths. | |
colours = cmap(norm(deaths)) | |
# Build a simple colour dictionary indexed by country name. | |
colour_dict = dict(zip(deaths.index, colours)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment