Skip to content

Commit 27d94d0

Browse files
authored
Merge pull request matplotlib#28587 from martinosorb/dark-divergent
Added dark-mode diverging colormaps
2 parents f7b3def + 5c4c028 commit 27d94d0

File tree

4 files changed

+809
-2
lines changed

4 files changed

+809
-2
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Dark-mode diverging colormaps
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Three diverging colormaps have been added: "berlin", "managua", and "vanimo".
5+
They are dark-mode diverging colormaps, with minimum lightness at the center,
6+
and maximum at the extremes. These are taken from F. Crameri's Scientific
7+
colour maps version 8.0.1 (DOI: https://doi.org/10.5281/zenodo.1243862).
8+
9+
10+
.. plot::
11+
:include-source: true
12+
:alt: Example figures using "imshow" with dark-mode diverging colormaps on positive and negative data. First panel: "berlin" (blue to red with a black center); second panel: "managua" (orange to cyan with a dark purple center); third panel: "vanimo" (pink to green with a black center).
13+
14+
import numpy as np
15+
import matplotlib.pyplot as plt
16+
17+
vals = np.linspace(-5, 5, 100)
18+
x, y = np.meshgrid(vals, vals)
19+
img = np.sin(x*y)
20+
21+
_, ax = plt.subplots(1, 3)
22+
ax[0].imshow(img, cmap=plt.cm.berlin)
23+
ax[1].imshow(img, cmap=plt.cm.managua)
24+
ax[2].imshow(img, cmap=plt.cm.vanimo)

galleries/examples/color/colormap_reference.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
'hot', 'afmhot', 'gist_heat', 'copper']),
3030
('Diverging', [
3131
'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu',
32-
'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']),
32+
'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic',
33+
'berlin', 'managua', 'vanimo']),
3334
('Cyclic', ['twilight', 'twilight_shifted', 'hsv']),
3435
('Qualitative', [
3536
'Pastel1', 'Pastel2', 'Paired', 'Accent',

galleries/users_explain/colors/colormaps.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,15 @@ def plot_color_gradients(category, cmap_list):
175175
# equal minimum :math:`L^*` values at opposite ends of the colormap. By these
176176
# measures, BrBG and RdBu are good options. coolwarm is a good option, but it
177177
# doesn't span a wide range of :math:`L^*` values (see grayscale section below).
178+
#
179+
# Berlin, Managua, and Vanimo are dark-mode diverging colormaps, with minimum
180+
# lightness at the center, and maximum at the extremes. These are taken from
181+
# F. Crameri's [scientific colour maps]_ version 8.0.1.
178182

179183
plot_color_gradients('Diverging',
180184
['PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu', 'RdYlBu',
181-
'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic'])
185+
'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic',
186+
'berlin', 'managua', 'vanimo'])
182187

183188
# %%
184189
# Cyclic
@@ -441,3 +446,4 @@ def plot_color_gradients(cmap_category, cmap_list):
441446
# .. [colorblindness] http://www.color-blindness.com/
442447
# .. [IBM] https://doi.org/10.1109/VISUAL.1995.480803
443448
# .. [turbo] https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html
449+
# .. [scientific colour maps] https://doi.org/10.5281/zenodo.1243862

0 commit comments

Comments
 (0)