Skip to content

Instantly share code, notes, and snippets.

@kaspermunch
Created April 25, 2024 15:40
Show Gist options
  • Save kaspermunch/286b5d8f9ec8917e68dc0d47d81add6a to your computer and use it in GitHub Desktop.
Save kaspermunch/286b5d8f9ec8917e68dc0d47d81add6a to your computer and use it in GitHub Desktop.
custom color map
import matplotlib.pyplot as plt
import matplotlib.colors as clr
import numpy as np
some_matrix = np.random.rand(10, 10)
cmap = clr.LinearSegmentedColormap.from_list('custom colormap',
['white', 'gold', 'red', 'magenta', 'blue', 'black'],
N=256)
sns.heatmap(some_matrix, cmap=cmap)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment