8000 Merge pull request #9871 from jamienunez/cividis_temp · matplotlib/matplotlib@fd4b541 · GitHub
[go: up one dir, main page]

Skip to content

Commit fd4b541

Browse files
authored
Merge pull request #9871 from jamienunez/cividis_temp
ENH: Cividis colormap added with short description in whats_new
2 parents 4900681 + 877f3af commit fd4b541

File tree

3 files changed

+272
-2
lines changed

3 files changed

+272
-2
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Cividis colormap
2+
----------------------------
3+
4+
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."
5+
6+
.. plot::
7+
8+
import matplotlib.pyplot as plt
9+
import numpy as np
10+
11+
fig, ax = plt.subplots()
12+
pcm = ax.pcolormesh(np.random.rand(32,32), cmap='cividis')
13+
fig.colorbar(pcm)

examples/color/colormap_reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
cmaps = [('Perceptually Uniform Sequential', [
20-
'viridis', 'plasma', 'inferno', 'magma']),
20+
'viridis', 'plasma', 'inferno', 'magma', 'cividis']),
2121
('Sequential', [
2222
'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds',
2323
'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',

lib/matplotlib/_cm_listed.py

Lines changed: 258 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,12 +1028,269 @@
10281028
[0.983868, 0.904867, 0.136897],
10291029
[0.993248, 0.906157, 0.143936]]
10301030

1031+
_cividis_data = [[0.000000, 0.135112, 0.304751],
1032+
[0.000000, 0.138068, 0.311105],
1033+
[0.000000, 0.141013, 0.317579],
1034+
[0.000000, 0.143951, 0.323982],
1035+
[0.000000, 0.146877, 0.330479],
1036+
[0.000000, 0.149791, 0.337065],
1037+
[0.000000, 0.152673, 0.343704],
1038+
[0.000000, 0.155377, 0.350500],
1039+
[0.000000, 0.157932, 0.357521],
1040+
[0.000000, 0.160495, 0.364534],
1041+
[0.000000, 0.163058, 0.371608],
1042+
[0.000000, 0.165621, 0.378769],
1043+
[0.000000, 0.168204, 0.385902],
1044+
[0.000000, 0.170800, 0.393100],
1045+
[0.000000, 0.173420, 0.400353],
1046+
[0.000000, 0.176082, 0.407577],
1047+
[0.000000, 0.178802, 0.414764],
1048+
[0.000000, 0.181610, 0.421859],
1049+
[0.000000, 0.184550, 0.428802],
1050+
[0.000000, 0.186915, 0.435532],
1051+
[0.000000, 0.188769, 0.439563],
1052+
[0.000000, 0.190950, 0.441085],
1053+
[0.000000, 0.193366, 0.441561],
1054+
[0.003602, 0.195911, 0.441564],
1055+
[0.017852, 0.198528, 0.441248],
1056+
[0.032110, 0.201199, 0.440785],
1057+
[0.046205, 0.203903, 0.440196],
1058+
[0.058378, 0.206629, 0.439531],
1059+
[0.068968, 0.209372, 0.438863],
1060+
[0.078624, 0.212122, 0.438105],
1061+
[0.087465, 0.214879, 0.437342],
1062+
[0.095645, 0.217643, 0.436593],
1063+
[0.103401, 0.220406, 0.435790],
1064+
[0.110658, 0.223170, 0.435067],
1065+
[0.117612, 0.225935, 0.434308],
1066+
[0.124291, 0.228697, 0.433547],
1067+
[0.130669, 0.231458, 0.432840],
1068+
[0.136830, 0.234216, 0.432148],
1069+
[0.142852, 0.236972, 0.431404],
1070+
[0.148638, 0.239724, 0.430752],
1071+
[0.154261, 0.242475, 0.430120],
1072+
[0.159733, 0.245221, 0.429528],
1073+
[0.165113, 0.247965, 0.428908],
1074+
[0.170362, 0.250707, 0.428325],
1075+
[0.175490, 0.253444, 0.427790],
1076+
[0.180503, 0.256180, 0.427299],
1077+
[0.185453, 0.258914, 0.426788],
1078+
[0.190303, 0.261644, 0.426329],
1079+
[0.195057, 0.264372, 0.425924],
1080+
[0.199764, 0.267099, 0.425497],
1081+
[0.204385, 0.269823, 0.425126],
1082+
[0.208926, 0.272546, 0.424809],
1083+
[0.213431, 0.275266, 0.424480],
1084+
[0.217863, 0.277985, 0.424206],
1085+
[0.222264, 0.280702, 0.423914],
1086+
[0.226598, 0.283419, 0.423678],
1087+
[0.230871, 0.286134, 0.423498],
1088+
[0.235120, 0.288848, 0.423304],
1089+
[0.239312, 0.291562, 0.423167],
1090+
[0.243485, 0.294274, 0.423014],
1091+
[0.247605, 0.296986, 0.422917],
1092+
[0.251675, 0.299698, 0.422873],
1093+
[0.255731, 0.302409, 0.422814],
1094+
[0.259740, 0.305120, 0.422810],
1095+
[0.263738, 0.307831, 0.422789],
1096+
[0.267693, 0.310542, 0.422821],
1097+
[0.271639, 0.313253, 0.422837],
1098+
[0.275513, 0.315965, 0.422979],
1099+
[0.279411, 0.318677, 0.423031],
1100+
[0.283240, 0.321390, 0.423211],
1101+
[0.287065, 0.324103, 0.423373],
1102+
[0.290884, 0.326816, 0.423517],
1103+
[0.294669, 0.329531, 0.423716],
1104+
[0.298421, 0.332247, 0.423973],
1105+
[0.302169, 0.334963, 0.424213],
1106+
[0.305886, 0.337681, 0.424512],
1107+
[0.309601, 0.340399, 0.424790],
1108+
[0.313287, 0.343120, 0.425120],
1109+
[0.316941, 0.345842, 0.425512],
1110+
[0.320595, 0.348565, 0.425889],
1111+
[0.324250, 0.351289, 0.426250],
1112+
[0.327875, 0.354016, 0.426670],
1113+
[0.331474, 0.356744, 0.427144],
1114+
[0.335073, 0.359474, 0.427605],
1115+
[0.338673, 0.362206, 0.428053],
1116+
[0.342246, 0.364939, 0.428559],
1117+
[0.345793, 0.367676, 0.429127],
1118+
[0.349341, 0.370414, 0.429685],
1119+
[0.352892, 0.373153, 0.430226],
1120+
[0.356418, 0.375896, 0.430823],
1121+
[0.359916, 0.378641, 0.431501],
1122+
[0.363446, 0.381388, 0.432075],
1123+
[0.366923, 0.384139, 0.432796],
1124+
[0.370430, 0.386890, 0.433428],
1125+
[0.373884, 0.389646, 0.434209],
1126+
[0.377371, 0.392404, 0.434890],
1127+
[0.380830, 0.395164, 0.435653],
1128+
[0.384268, 0.397928, 0.436475],
1129+
[0.387705, 0.400694, 0.437305],
1130+
[0.391151, 0.403464, 0.438096],
1131+
[0.394568, 0.406236, 0.438986],
1132+
[0.397991, 0.409011, 0.439848],
1133+
[0.401418, 0.411790, 0.440708],
1134+
[0.404820, 0.414572, 0.441642],
1135+
[0.408226, 0.417357, 0.442570],
1136+
[0.411607, 0.420145, 0.443577],
1137+
[0.414992, 0.422937, 0.444578],
1138+
[0.418383, 0 10000 .425733, 0.445560],
1139+
[0.421748, 0.428531, 0.446640],
1140+
[0.425120, 0.431334, 0.447692],
1141+
[0.428462, 0.434140, 0.448864],
1142+
[0.431817, 0.436950, 0.449982],
1143+
[0.435168, 0.439763, 0.451134],
1144+
[0.438504, 0.442580, 0.452341],
1145+
[0.441810, 0.445402, 0.453659],
1146+
[0.445148, 0.448226, 0.454885],
1147+
[0.448447, 0.451053, 0.456264],
1148+
[0.451759, 0.453887, 0.457582],
1149+
[0.455072, 0.456718, 0.458976],
1150+
[0.458366, 0.459552, 0.460457],
1151+
[0.461616, 0.462405, 0.461969],
1152+
[0.464947, 0.465241, 0.463395],
1153+
[0.468254, 0.468083, 0.464908],
1154+
[0.471501, 0.470960, 0.466357],
1155+
[0.474812, 0.473832, 0.467681],
1156+
[0.478186, 0.476699, 0.468845],
1157+
[0.481622, 0.479573, 0.469767],
1158+
[0.485141, 0.482451, 0.470384],
1159+
[0.488697, 0.485318, 0.471008],
1160+
[0.492278, 0.488198, 0.471453],
1161+
[0.495913, 0.491076, 0.471751],
1162+
[0.499552, 0.493960, 0.472032],
1163+
[0.503185, 0.496851, 0.472305],
1164+
[0.506866, 0.499743, 0.472432],
1165+
[0.510540, 0.502643, 0.472550],
1166+
[0.514226, 0.505546, 0.472640],
1167+
[0.517920, 0.508454, 0.472707],
1168+
[0.521643, 0.511367, 0.472639],
1169+
[0.525348, 0.514285, 0.472660],
1170+
[0.529086, 0.517207, 0.472543],
1171+
[0.532829, 0.520135, 0.472401],
1172+
[0.536553, 0.523067, 0.472352],
1173+
[0.540307, 0.526005, 0.472163],
1174+
[0.544069, 0.528948, 0.471947],
1175+
[0.547840, 0.531895, 0.471704],
1176+
[0.551612, 0.534849, 0.471439],
1177+
[0.555393, 0.537807, 0.471147],
1178+
[0.559181, 0.540771, 0.470829],
1179+
[0.562972, 0.543741, 0.470488],
1180+
[0.566802, 0.546715, 0.469988],
1181+
[0.570607, 0.549695, 0.469593],
1182+
[0.574417, 0.552682, 0.469172],
1183+
[0.578236, 0.555673, 0.468724],
1184+
[0.582087, 0.558670, 0.468118],
1185+
[0.585916, 0.561674, 0.467618],
1186+
[0.589753, 0.564682, 0.467090],
1187+
[0.593622, 0.567697, 0.466401],
1188+
[0.597469, 0.570718, 0.465821],
1189+
[0.601354, 0.573743, 0.465074],
1190+
[0.605211, 0.576777, 0.464441],
1191+
[0.609105, 0.579816, 0.463638],
1192+
[0.612977, 0.582861, 0.462950],
1193+
[0.616852, 0.585913, 0.462237],
1194+
[0.620765, 0.588970, 0.461351],
1195+
[0.624654, 0.592034, 0.460583],
1196+
[0.628576, 0.595104, 0.459641],
1197+
[0.632506, 0.598180, 0.458668],
1198+
[0.636412, 0.601264, 0.457818],
1199+
[0.640352, 0.604354, 0.456791],
1200+
[0.644270, 0.607450, 0.455886],
1201+
[0.648222, 0.610553, 0.454801],
1202+
[0.652178, 0.613664, 0.453689],
1203+
[0.656114, 0.616780, 0.452702],
1204+
[0.660082, 0.619904, 0.451534],
1205+
[0.664055, 0.623034, 0.450338],
1206+
[0.668008, 0.626171, 0.449270],
1207+
[0.671991, 0.629316, 0.448018],
1208+
[0.675981, 0.632468, 0.446736],
1209+
[0.679979, 0.635626, 0.445424],
1210+
[0.683950, 0.638793, 0.444251],
1211+
[0.687957, 0.641966, 0.442886],
1212+
[0.691971, 0.645145, 0.441491],
1213+
[0.695985, 0.648334, 0.440072],
1214+
[0.700008, 0.651529, 0.438624],
1215+
[0.704037, 0.654731, 0.437147],
1216+
[0.708067, 0.657942, 0.435647],
1217+
[0.712105, 0.661160, 0.434117],
1218+
[0.716177, 0.664384, 0.432386],
1219+
[0.720222, 0.667618, 0.430805],
1220+
[0.724274, 0.670859, 0.429194],
1221+
[0.728334, 0.674107, 0.427554],
1222+
[0.732422, 0.677364, 0.425717],
1223+
[0.736488, 0.680629, 0.424028],
1224+
[0.740589, 0.683900, 0.422131],
1225+
[0.744664, 0.687181, 0.420393],
1226+
[0.748772, 0.690470, 0.418448],
1227+
[0.752886, 0.693766, 0.416472],
1228+
[0.756975, 0.697071, 0.414659],
1229+
[0.761096, 0.700384, 0.412638],
1230+
[0.765223, 0.703705, 0.410587],
1231+
[0.769353, 0.707035, 0.408516],
1232+
[0.773486, 0.710373, 0.406422],
1233+
[0.777651, 0.713719, 0.404112],
1234+
[0.781795, 0.717074, 0.401966],
1235+
[0.785965, 0.720438, 0.399613],
1236+
[0.790116, 0.723810, 0.397423],
1237+
[0.794298, 0.727190, 0.395016],
1238+
[0.798480, 0.730580, 0.392597],
1239+
[0.802667, 0.733978, 0.390153],
1240+
[0.806859, 0.737385, 0.387684],
1241+
[0.811054, 0.740801, 0.385198],
1242+
[0.815274, 0.744226, 0.382504],
1243+
[0.819499, 0.747659, 0.379785],
1244+
[0.823729, 0.751101, 0.377043],
1245+
[0.827959, 0.754553, 0.374292],
1246+
[0.832192, 0.758014, 0.371529],
1247+
[0.836429, 0.761483, 0.368747],
1248+
[0.840693, 0.764962, 0.365746],
1249+
[0.844957, 0.768450, 0.362741],
1250+
[0.849223, 0.771947, 0.359729],
1251+
[0.853515, 0.775454, 0.356500],
1252+
[0.857809, 0.778969, 0.353259],
1253+
[0.862105, 0.782494, 0.350011],
1254+
[0.866421, 0.786028, 0.346571],
1255+
[0.870717, 0.789572, 0.343333],
1256+
[0.875057, 0.793125, 0.339685],
1257+
[0.879378, 0.796687, 0.336241],
1258+
[0.883720, 0.800258, 0.332599],
1259+
[0.888081, 0.803839, 0.328770],
1260+
[0.892440, 0.807430, 0.324968],
1261+
[0.896818, 0.811030, 0.320982],
1262+
[0.901195, 0.814639, 0.317021],
1263+
[0.905589, 0.818257, 0.312889],
1264+
[0.910000, 0.821885, 0.308594],
1265+
[0.914407, 0.825522, 0.304348],
1266+
[0.918828, 0.829168, 0.299960],
1267+
[0.923279, 0.832822, 0.295244],
1268+
[0.927724, 0.836486, 0.290611],
1269+
[0.932180, 0.840159, 0.285880],
1270+
[0.936660, 0.843841, 0.280876],
1271+
[0.941147, 0.847530, 0.275815],
1272+
[0.945654, 0.851228, 0.270532],
1273+
[0.950178, 0.854933, 0.265085],
1274+
[0.954725, 0.858646, 0.259365],
1275+
[0.959284, 0.862365, 0.253563],
1276+
[0.963872, 0.866089, 0.247445],
1277+
[0.968469, 0.869819, 0.241310],
1278+
[0.973114, 0.873550, 0.234677],
1279+
[0.977780, 0.877281, 0.227954],
1280+
[0.982497, 0.881008, 0.220878],
1281+
[0.987293, 0.884718, 0.213336],
1282+
[0.992218, 0.888385, 0.205468],
1283+
[0.994847, 0.892954, 0.203445],
1284+
[0.995249, 0.898384, 0.207561],
1285+
[0.995503, 0.903866, 0.212370],
1286+
[0.995737, 0.909344, 0.217772]]
10311287

10321288
cmaps = {}
10331289
for (name, data) in (('magma', _magma_data),
10341290
('inferno', _inferno_data),
10351291
('plasma', _plasma_data),
1036-
('viridis', _viridis_data)):
1292+
('viridis', _viridis_data),
1293+
('cividis', _cividis_data)):
10371294

10381295
cmaps[name] = ListedColormap(data, name=name)
10391296
# generate reversed colormap

0 commit comments

Comments
 (0)
0