text_plain_output_1.png
from matplotlib.colors import ListedColormap, LinearSegmentedColormap

import matplotlib.pyplot as plt

import numpy as np

def plot_examples(colormaps):
    """
    Helper function to plot data with associated colormap.
    """
    np.random.seed(19680801)
    data = np.random.randn(30, 30)
    n = len(colormaps)
    fig, axs = plt.subplots(1, n, figsize=(n * 2 + 2, 3),
                            constrained_layout=True, squeeze=False)
    for [ax, cmap] in zip(axs.flat, colormaps):
        psm = ax.pcolormesh(data, cmap=cmap, rasterized=True, vmin=-4, vmax=4)
        fig.colorbar(psm, ax=ax)
    plt.show()

my_palette = ['#3c9ab2', '#56a6ba', '#71b3c2', '#88b774', '#d1c74c', '#e8c520', '#e4b80d', '#e29e00', '#ea5c00', '#f22300']
cmap = ListedColormap(my_palette)
cmap_members = ListedColormap(['#d1c74c', '#88b774', '#71b3c2', '#56a6ba', '#3c9ab2'])
cmap_casual = ListedColormap(['#e8c520', '#e4b80d', '#e29e00', '#ea5c00', '#f22300'])
colors_member_casual = {'Member': '#88b774', 'Casual': '#ea5c00'}
colors_day_of_week = {'Monday': '#3c9ab2', 'Tuesday': '#71b3c2', 'Wednesday': '#88b774', 'Thursday': '#ffde45', 'Friday': '#e4b80d', 'Saturday': '#ea5c00', 'Sunday': '#f22300'}

plot_examples([cmap])