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
import matplotlib.pyplot as plt | |
import matplotlib.colors as mcolors | |
def plot_colormap(): | |
colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS) | |
# Sort colors by hue, saturation, value and name. | |
by_hsv = sorted((tuple(mcolors.rgb_to_hsv(mcolors.to_rgb(color))), name) | |
for name, color in colors.items()) | |
sorted_names = [name for hsv, name in by_hsv] |