For a density plot I need a colormap ranging from maroon over red, yellow, green, blue to black. I defined the following colormap:
cdict1 = {'maroon': ((0.0, 0.0, 0.8),
(1/6, 1.0, 1.0)),
'red': ((1/6, 0.0, 0.8),
(2/6, 1.0, 0.0)),
'yellow': ((2/6, 0.0, 0.8),
(3/6, 1.0, 0.0)),
'green': ((3/6, 0.0, 0.8),
(4/6, 1.0, 0.0)),
'blue': ((4/6, 0.0, 0.8),
(5/6, 1.0, 0.0)),
'black': ((5/6, 0.0, 0.8),
(1.0, 1.0, 0.0))
}
wblack = LinearSegmentedColormap('wblack', cdict1)
plt.register_cmap(cmap=wblack)
Colormap legend:
But the "black" is completely ignored such that the colormap ranges from maroon to dark blue but not to black. Can somebody tell me what I´m doing wrong and how to correctly add black to my colormap?