This could be your favourite colourblind-friendly wide dynamic range colour map
Published:
This is my current favourite replacement for jet, or any other ‘rainbow-like’ colour map. It is based on the Okabe-Ito palette, which is designed to be colourblind-friendly, and extended into a continuous map with a pleasantly wide dynamic range. I am mildly offended that this is not already included in Matplotlib as a built-in colormap.
If you are curious about how colourblind people actually perceive colour (and why palettes like this matter), this is a genuinely fascinating read, and the source of this palette:
You are very welcome to take the following code and use it in your own plots.
from matplotlib.colors import LinearSegmentedColormap
import matplotlib.colors as mcolors
def okabe_ito_cmap(n: int = 256) -> LinearSegmentedColormap:
"""
Continuous colour map built from the Okabe-Ito colourblind-friendly palette.
(Black excluded to avoid confusion with NaNs or annotations.)
"""
colors = [
"#0072B2", # Blue
"#56B4E9", # Sky blue
"#009E73", # Bluish green
"#F0E442", # Yellow
"#E69F00", # Orange
"#D55E00", # Vermilion
"#CC79A7", # Reddish purple
]
return mcolors.LinearSegmentedColormap.from_list("okabe_ito", colors, N=n)
