Skip to content

Cividis colormap added with short description in whats_new #9871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions doc/users/next_whats_new/2017-12-05_cividis_colormap.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Cividis colormap
----------------------------

A new dark blue/yellow colormap named 'cividis' was added. Like viridis, cividis is perceptually uniform and colorblind friendly. However, cividis also goes a step further: not only is it usable by colorblind users, it should actually look effectively identical to colorblind and non-colorblind users. For more details, see Nunez J, Anderton C, and Renslow R. (submitted). Optimizing colormaps with consideration for color vision deficiency to enable accurate interpretation of scientific data."

.. plot::

import matplotlib.pyplot as plt
import numpy as np

fig, ax = plt.subplots()
pcm = ax.pcolormesh(np.random.rand(32,32), cmap='cividis')
fig.colorbar(pcm)
2 changes: 1 addition & 1 deletion examples/color/colormap_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


cmaps = [('Perceptually Uniform Sequential', [
'viridis', 'plasma', 'inferno', 'magma']),
'viridis', 'plasma', 'inferno', 'magma', 'cividis']),
('Sequential', [
'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds',
'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',
Expand Down
259 changes: 258 additions & 1 deletion lib/matplotlib/_cm_listed.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,12 +1028,269 @@
[0.983868, 0.904867, 0.136897],
[0.993248, 0.906157, 0.143936]]

_cividis_data = [[0.000000, 0.135112, 0.304751],
[0.000000, 0.138068, 0.311105],
[0.000000, 0.141013, 0.317579],
[0.000000, 0.143951, 0.323982],
[0.000000, 0.146877, 0.330479],
[0.000000, 0.149791, 0.337065],
[0.000000, 0.152673, 0.343704],
[0.000000, 0.155377, 0.350500],
[0.000000, 0.157932, 0.357521],
[0.000000, 0.160495, 0.364534],
[0.000000, 0.163058, 0.371608],
[0.000000, 0.165621, 0.378769],
[0.000000, 0.168204, 0.385902],
[0.000000, 0.170800, 0.393100],
[0.000000, 0.173420, 0.400353],
[0.000000, 0.176082, 0.407577],
[0.000000, 0.178802, 0.414764],
[0.000000, 0.181610, 0.421859],
[0.000000, 0.184550, 0.428802],
[0.000000, 0.186915, 0.435532],
[0.000000, 0.188769, 0.439563],
[0.000000, 0.190950, 0.441085],
[0.000000, 0.193366, 0.441561],
[0.003602, 0.195911, 0.441564],
[0.017852, 0.198528, 0.441248],
[0.032110, 0.201199, 0.440785],
[0.046205, 0.203903, 0.440196],
[0.058378, 0.206629, 0.439531],
[0.068968, 0.209372, 0.438863],
[0.078624, 0.212122, 0.438105],
[0.087465, 0.214879, 0.437342],
[0.095645, 0.217643, 0.436593],
[0.103401, 0.220406, 0.435790],
[0.110658, 0.223170, 0.435067],
[0.117612, 0.225935, 0.434308],
[0.124291, 0.228697, 0.433547],
[0.130669, 0.231458, 0.432840],
[0.136830, 0.234216, 0.432148],
[0.142852, 0.236972, 0.431404],
[0.148638, 0.239724, 0.430752],
[0.154261, 0.242475, 0.430120],
[0.159733, 0.245221, 0.429528],
[0.165113, 0.247965, 0.428908],
[0.170362, 0.250707, 0.428325],
[0.175490, 0.253444, 0.427790],
[0.180503, 0.256180, 0.427299],
[0.185453, 0.258914, 0.426788],
[0.190303, 0.261644, 0.426329],
[0.195057, 0.264372, 0.425924],
[0.199764, 0.267099, 0.425497],
[0.204385, 0.269823, 0.425126],
[0.208926, 0.272546, 0.424809],
[0.213431, 0.275266, 0.424480],
[0.217863, 0.277985, 0.424206],
[0.222264, 0.280702, 0.423914],
[0.226598, 0.283419, 0.423678],
[0.230871, 0.286134, 0.423498],
[0.235120, 0.288848, 0.423304],
[0.239312, 0.291562, 0.423167],
[0.243485, 0.294274, 0.423014],
[0.247605, 0.296986, 0.422917],
[0.251675, 0.299698, 0.422873],
[0.255731, 0.302409, 0.422814],
[0.259740, 0.305120, 0.422810],
[0.263738, 0.307831, 0.422789],
[0.267693, 0.310542, 0.422821],
[0.271639, 0.313253, 0.422837],
[0.275513, 0.315965, 0.422979],
[0.279411, 0.318677, 0.423031],
[0.283240, 0.321390, 0.423211],
[0.287065, 0.324103, 0.423373],
[0.290884, 0.326816, 0.423517],
[0.294669, 0.329531, 0.423716],
[0.298421, 0.332247, 0.423973],
[0.302169, 0.334963, 0.424213],
[0.305886, 0.337681, 0.424512],
[0.309601, 0.340399, 0.424790],
[0.313287, 0.343120, 0.425120],
[0.316941, 0.345842, 0.425512],
[0.320595, 0.348565, 0.425889],
[0.324250, 0.351289, 0.426250],
[0.327875, 0.354016, 0.426670],
[0.331474, 0.356744, 0.427144],
[0.335073, 0.359474, 0.427605],
[0.338673, 0.362206, 0.428053],
[0.342246, 0.364939, 0.428559],
[0.345793, 0.367676, 0.429127],
[0.349341, 0.370414, 0.429685],
[0.352892, 0.373153, 0.430226],
[0.356418, 0.375896, 0.430823],
[0.359916, 0.378641, 0.431501],
[0.363446, 0.381388, 0.432075],
[0.366923, 0.384139, 0.432796],
[0.370430, 0.386890, 0.433428],
[0.373884, 0.389646, 0.434209],
[0.377371, 0.392404, 0.434890],
[0.380830, 0.395164, 0.435653],
[0.384268, 0.397928, 0.436475],
[0.387705, 0.400694, 0.437305],
[0.391151, 0.403464, 0.438096],
[0.394568, 0.406236, 0.438986],
[0.397991, 0.409011, 0.439848],
[0.401418, 0.411790, 0.440708],
[0.404820, 0.414572, 0.441642],
[0.408226, 0.417357, 0.442570],
[0.411607, 0.420145, 0.443577],
[0.414992, 0.422937, 0.444578],
[0.418383, 0.425733, 0.445560],
[0.421748, 0.428531, 0.446640],
[0.425120, 0.431334, 0.447692],
[0.428462, 0.434140, 0.448864],
[0.431817, 0.436950, 0.449982],
[0.435168, 0.439763, 0.451134],
[0.438504, 0.442580, 0.452341],
[0.441810, 0.445402, 0.453659],
[0.445148, 0.448226, 0.454885],
[0.448447, 0.451053, 0.456264],
[0.451759, 0.453887, 0.457582],
[0.455072, 0.456718, 0.458976],
[0.458366, 0.459552, 0.460457],
[0.461616, 0.462405, 0.461969],
[0.464947, 0.465241, 0.463395],
[0.468254, 0.468083, 0.464908],
[0.471501, 0.470960, 0.466357],
[0.474812, 0.473832, 0.467681],
[0.478186, 0.476699, 0.468845],
[0.481622, 0.479573, 0.469767],
[0.485141, 0.482451, 0.470384],
[0.488697, 0.485318, 0.471008],
[0.492278, 0.488198, 0.471453],
[0.495913, 0.491076, 0.471751],
[0.499552, 0.493960, 0.472032],
[0.503185, 0.496851, 0.472305],
[0.506866, 0.499743, 0.472432],
[0.510540, 0.502643, 0.472550],
[0.514226, 0.505546, 0.472640],
[0.517920, 0.508454, 0.472707],
[0.521643, 0.511367, 0.472639],
[0.525348, 0.514285, 0.472660],
[0.529086, 0.517207, 0.472543],
[0.532829, 0.520135, 0.472401],
[0.536553, 0.523067, 0.472352],
[0.540307, 0.526005, 0.472163],
[0.544069, 0.528948, 0.471947],
[0.547840, 0.531895, 0.471704],
[0.551612, 0.534849, 0.471439],
[0.555393, 0.537807, 0.471147],
[0.559181, 0.540771, 0.470829],
[0.562972, 0.543741, 0.470488],
[0.566802, 0.546715, 0.469988],
[0.570607, 0.549695, 0.469593],
[0.574417, 0.552682, 0.469172],
[0.578236, 0.555673, 0.468724],
[0.582087, 0.558670, 0.468118],
[0.585916, 0.561674, 0.467618],
[0.589753, 0.564682, 0.467090],
[0.593622, 0.567697, 0.466401],
[0.597469, 0.570718, 0.465821],
[0.601354, 0.573743, 0.465074],
[0.605211, 0.576777, 0.464441],
[0.609105, 0.579816, 0.463638],
[0.612977, 0.582861, 0.462950],
[0.616852, 0.585913, 0.462237],
[0.620765, 0.588970, 0.461351],
[0.624654, 0.592034, 0.460583],
[0.628576, 0.595104, 0.459641],
[0.632506, 0.598180, 0.458668],
[0.636412, 0.601264, 0.457818],
[0.640352, 0.604354, 0.456791],
[0.644270, 0.607450, 0.455886],
[0.648222, 0.610553, 0.454801],
[0.652178, 0.613664, 0.453689],
[0.656114, 0.616780, 0.452702],
[0.660082, 0.619904, 0.451534],
[0.664055, 0.623034, 0.450338],
[0.668008, 0.626171, 0.449270],
[0.671991, 0.629316, 0.448018],
[0.675981, 0.632468, 0.446736],
[0.679979, 0.635626, 0.445424],
[0.683950, 0.638793, 0.444251],
[0.687957, 0.641966, 0.442886],
[0.691971, 0.645145, 0.441491],
[0.695985, 0.648334, 0.440072],
[0.700008, 0.651529, 0.438624],
[0.704037, 0.654731, 0.437147],
[0.708067, 0.657942, 0.435647],
[0.712105, 0.661160, 0.434117],
[0.716177, 0.664384, 0.432386],
[0.720222, 0.667618, 0.430805],
[0.724274, 0.670859, 0.429194],
[0.728334, 0.674107, 0.427554],
[0.732422, 0.677364, 0.425717],
[0.736488, 0.680629, 0.424028],
[0.740589, 0.683900, 0.422131],
[0.744664, 0.687181, 0.420393],
[0.748772, 0.690470, 0.418448],
[0.752886, 0.693766, 0.416472],
[0.756975, 0.697071, 0.414659],
[0.761096, 0.700384, 0.412638],
[0.765223, 0.703705, 0.410587],
[0.769353, 0.707035, 0.408516],
[0.773486, 0.710373, 0.406422],
[0.777651, 0.713719, 0.404112],
[0.781795, 0.717074, 0.401966],
[0.785965, 0.720438, 0.399613],
[0.790116, 0.723810, 0.397423],
[0.794298, 0.727190, 0.395016],
[0.798480, 0.730580, 0.392597],
[0.802667, 0.733978, 0.390153],
[0.806859, 0.737385, 0.387684],
[0.811054, 0.740801, 0.385198],
[0.815274, 0.744226, 0.382504],
[0.819499, 0.747659, 0.379785],
[0.823729, 0.751101, 0.377043],
[0.827959, 0.754553, 0.374292],
[0.832192, 0.758014, 0.371529],
[0.836429, 0.761483, 0.368747],
[0.840693, 0.764962, 0.365746],
[0.844957, 0.768450, 0.362741],
[0.849223, 0.771947, 0.359729],
[0.853515, 0.775454, 0.356500],
[0.857809, 0.778969, 0.353259],
[0.862105, 0.782494, 0.350011],
[0.866421, 0.786028, 0.346571],
[0.870717, 0.789572, 0.343333],
[0.875057, 0.793125, 0.339685],
[0.879378, 0.796687, 0.336241],
[0.883720, 0.800258, 0.332599],
[0.888081, 0.803839, 0.328770],
[0.892440, 0.807430, 0.324968],
[0.896818, 0.811030, 0.320982],
[0.901195, 0.814639, 0.317021],
[0.905589, 0.818257, 0.312889],
[0.910000, 0.821885, 0.308594],
[0.914407, 0.825522, 0.304348],
[0.918828, 0.829168, 0.299960],
[0.923279, 0.832822, 0.295244],
[0.927724, 0.836486, 0.290611],
[0.932180, 0.840159, 0.285880],
[0.936660, 0.843841, 0.280876],
[0.941147, 0.847530, 0.275815],
[0.945654, 0.851228, 0.270532],
[0.950178, 0.854933, 0.265085],
[0.954725, 0.858646, 0.259365],
[0.959284, 0.862365, 0.253563],
[0.963872, 0.866089, 0.247445],
[0.968469, 0.869819, 0.241310],
[0.973114, 0.873550, 0.234677],
[0.977780, 0.877281, 0.227954],
[0.982497, 0.881008, 0.220878],
[0.987293, 0.884718, 0.213336],
[0.992218, 0.888385, 0.205468],
[0.994847, 0.892954, 0.203445],
[0.995249, 0.898384, 0.207561],
[0.995503, 0.903866, 0.212370],
[0.995737, 0.909344, 0.217772]]

cmaps = {}
for (name, data) in (('magma', _magma_data),
('inferno', _inferno_data),
('plasma', _plasma_data),
('viridis', _viridis_data)):
('viridis', _viridis_data),
('cividis', _cividis_data)):

cmaps[name] = ListedColormap(data, name=name)
# generate reversed colormap
Expand Down