Skip to content

Instantly share code, notes, and snippets.

@dofuuz
Created March 10, 2022 07:16
Show Gist options
  • Save dofuuz/282036bd1c58be1c707bf39a1a3371d7 to your computer and use it in GitHub Desktop.
Save dofuuz/282036bd1c58be1c707bf39a1a3371d7 to your computer and use it in GitHub Desktop.
Audacity spectrogram colormap for Matplotlib
# Audacity spectrogram colormap data
# https://github.com/dofuuz/audacity-colormap
audaspec_data = [
[0.000009, 0.000025, 0.000020],
[0.000227, 0.000394, 0.000344],
[0.000630, 0.001132, 0.000994],
[0.001157, 0.002212, 0.001945],
[0.001770, 0.003620, 0.003193],
[0.002441, 0.005351, 0.004740],
[0.003146, 0.007400, 0.006596],
[0.003863, 0.009765, 0.008773],
[0.004574, 0.012444, 0.011284],
[0.005263, 0.015438, 0.014149],
[0.005915, 0.018745, 0.017385],
[0.006517, 0.022366, 0.021016],
[0.007055, 0.026298, 0.025066],
[0.007519, 0.030543, 0.029559],
[0.007899, 0.035100, 0.034526],
[0.008186, 0.039967, 0.039996],
[0.008372, 0.044917, 0.045704],
[0.008449, 0.049806, 0.051470],
[0.008412, 0.054644, 0.057306],
[0.008255, 0.059432, 0.063218],
[0.007976, 0.064172, 0.069213],
[0.007570, 0.068866, 0.075297],
[0.007036, 0.073514, 0.081473],
[0.006372, 0.078118, 0.087748],
[0.005580, 0.082677, 0.094126],
[0.004661, 0.087192, 0.100611],
[0.003616, 0.091663, 0.107209],
[0.002448, 0.096089, 0.113924],
[0.001162, 0.100471, 0.120761],
[0.000000, 0.104807, 0.127725],
[0.000000, 0.109097, 0.134820],
[0.000000, 0.113340, 0.142053],
[0.000000, 0.117535, 0.149430],
[0.000000, 0.121681, 0.156957],
[0.000000, 0.125775, 0.164635],
[0.000000, 0.129813, 0.172465],
[0.000000, 0.133793, 0.180449],
[0.000000, 0.137711, 0.188587],
[0.000000, 0.141564, 0.196880],
[0.000000, 0.145349, 0.205328],
[0.000000, 0.149061, 0.213929],
[0.000000, 0.152697, 0.222682],
[0.000000, 0.156253, 0.231586],
[0.000000, 0.159725, 0.240639],
[0.000000, 0.163108, 0.249838],
[0.000000, 0.166400, 0.259179],
[0.000000, 0.169595, 0.268659],
[0.000000, 0.172690, 0.278272],
[0.000000, 0.175679, 0.288013],
[0.000000, 0.178560, 0.297877],
[0.000000, 0.181327, 0.307856],
[0.000000, 0.183977, 0.317943],
[0.000000, 0.186505, 0.328132],
[0.000000, 0.188907, 0.338412],
[0.002729, 0.191180, 0.348776],
[0.010315, 0.193320, 0.359212],
[0.019126, 0.195323, 0.369711],
[0.029250, 0.197186, 0.380262],
[0.040768, 0.198906, 0.390852],
[0.052483, 0.200479, 0.401470],
[0.063783, 0.201904, 0.412102],
[0.074815, 0.203177, 0.422735],
[0.085670, 0.204298, 0.433355],
[0.096405, 0.205265, 0.443950],
[0.107060, 0.206075, 0.454507],
[0.117665, 0.206728, 0.465013],
[0.128237, 0.207223, 0.475456],
[0.138791, 0.207560, 0.485820],
[0.149336, 0.207739, 0.496093],
[0.159879, 0.207759, 0.506260],
[0.170424, 0.207622, 0.516308],
[0.180973, 0.207329, 0.526222],
[0.191527, 0.206882, 0.535989],
[0.202086, 0.206283, 0.545592],
[0.212649, 0.205535, 0.555019],
[0.223213, 0.204641, 0.564256],
[0.233776, 0.203606, 0.573288],
[0.244336, 0.202433, 0.582101],
[0.254889, 0.201127, 0.590682],
[0.265431, 0.199696, 0.599018],
[0.275959, 0.198143, 0.607098],
[0.286469, 0.196478, 0.614908],
[0.296957, 0.194706, 0.622438],
[0.307420, 0.192836, 0.629676],
[0.317853, 0.190876, 0.636613],
[0.328253, 0.188836, 0.643239],
[0.338617, 0.186725, 0.649545],
[0.348940, 0.184552, 0.655524],
[0.359220, 0.182330, 0.661170],
[0.369454, 0.180067, 0.666476],
[0.379638, 0.177775, 0.671437],
[0.389771, 0.175466, 0.676051],
[0.399850, 0.173149, 0.680314],
[0.409873, 0.170836, 0.684226],
[0.419839, 0.168538, 0.687787],
[0.429747, 0.166262, 0.690998],
[0.439603, 0.164004, 0.693879],
[0.449403, 0.161777, 0.696424],
[0.459147, 0.159595, 0.698630],
[0.468831, 0.157472, 0.700497],
[0.478455, 0.155420, 0.702024],
[0.488017, 0.153453, 0.703211],
[0.497516, 0.151585, 0.704058],
[0.506950, 0.149829, 0.704567],
[0.516318, 0.148198, 0.704739],
[0.525620, 0.146703, 0.704580],
[0.534854, 0.145357, 0.704090],
[0.544019, 0.144172, 0.703274],
[0.553114, 0.143157, 0.702137],
[0.562139, 0.142325, 0.700684],
[0.571092, 0.141683, 0.698918],
[0.579973, 0.141238, 0.696847],
[0.588780, 0.140999, 0.694477],
[0.597514, 0.140968, 0.691814],
[0.606175, 0.141147, 0.688868],
[0.614763, 0.141538, 0.685645],
[0.623276, 0.142142, 0.682154],
[0.631715, 0.142959, 0.678402],
[0.640078, 0.143988, 0.674397],
[0.648366, 0.145225, 0.670147],
[0.656579, 0.146667, 0.665661],
[0.664715, 0.148310, 0.660949],
[0.672775, 0.150147, 0.656018],
[0.680759, 0.152173, 0.650877],
[0.688666, 0.154382, 0.645535],
[0.696496, 0.156767, 0.640002],
[0.704248, 0.159323, 0.634285],
[0.711921, 0.162045, 0.628392],
[0.719512, 0.164932, 0.622330],
[0.727021, 0.167980, 0.616108],
[0.734445, 0.171183, 0.609734],
[0.741785, 0.174536, 0.603217],
[0.749037, 0.178039, 0.596564],
[0.756200, 0.181684, 0.589785],
[0.763274, 0.185467, 0.582887],
[0.770258, 0.189384, 0.575881],
[0.777150, 0.193431, 0.568774],
[0.783948, 0.197604, 0.561575],
[0.790653, 0.201898, 0.554292],
[0.797263, 0.206310, 0.546934],
[0.803777, 0.210836, 0.539508],
[0.810194, 0.215473, 0.532023],
[0.816513, 0.220219, 0.524486],
[0.822733, 0.225070, 0.516905],
[0.828853, 0.230023, 0.509287],
[0.834873, 0.235077, 0.501640],
[0.840792, 0.240228, 0.493969],
[0.846614, 0.245464, 0.486281],
[0.852346, 0.250773, 0.478581],
[0.857993, 0.256144, 0.470872],
[0.863557, 0.261572, 0.463156],
[0.869040, 0.267053, 0.455435],
[0.874445, 0.272582, 0.447711],
[0.879772, 0.278160, 0.439983],
[0.885022, 0.283785, 0.432253],
[0.890192, 0.289459, 0.424522],
[0.895284, 0.295182, 0.416789],
[0.900293, 0.300957, 0.409055],
[0.905220, 0.306787, 0.401321],
[0.910058, 0.312677, 0.393589],
[0.914797, 0.318642, 0.385866],
[0.919457, 0.324652, 0.378138],
[0.924035, 0.330712, 0.370404],
[0.928528, 0.336825, 0.362664],
[0.932932, 0.342996, 0.354919],
[0.937244, 0.349228, 0.347169],
[0.941459, 0.355524, 0.339414],
[0.945575, 0.361887, 0.331653],
[0.949587, 0.368320, 0.323887],
[0.953493, 0.374825, 0.316117],
[0.957289, 0.381404, 0.308343],
[0.960972, 0.388058, 0.300563],
[0.964541, 0.394787, 0.292776],
[0.967993, 0.401591, 0.284978],
[0.971326, 0.408470, 0.277169],
[0.974532, 0.415431, 0.269356],
[0.977601, 0.422481, 0.261546],
[0.980524, 0.429625, 0.253749],
[0.983293, 0.436867, 0.245977],
[0.985900, 0.444213, 0.238243],
[0.988337, 0.451665, 0.230560],
[0.990597, 0.459224, 0.222945],
[0.992674, 0.466891, 0.215414],
[0.994562, 0.474668, 0.207989],
[0.996254, 0.482555, 0.200694],
[0.997745, 0.490549, 0.193556],
[0.999032, 0.498651, 0.186607],
[1.000000, 0.506857, 0.179883],
[1.000000, 0.515166, 0.173425],
[1.000000, 0.523573, 0.167285],
[1.000000, 0.532077, 0.161519],
[1.000000, 0.540675, 0.156194],
[1.000000, 0.549361, 0.151385],
[1.000000, 0.558133, 0.147173],
[1.000000, 0.566986, 0.143646],
[1.000000, 0.575915, 0.140893],
[0.999807, 0.584915, 0.139003],
[0.998619, 0.593979, 0.138058],
[0.997197, 0.603103, 0.138129],
[0.995542, 0.612279, 0.139272],
[0.993657, 0.621501, 0.141523],
[0.991545, 0.630762, 0.144894],
[0.989209, 0.640054, 0.149378],
[0.986653, 0.649369, 0.154948],
[0.983884, 0.658701, 0.161564],
[0.980908, 0.668040, 0.169172],
[0.977733, 0.677379, 0.177714],
[0.974368, 0.686708, 0.187126],
[0.970824, 0.696019, 0.197348],
[0.967111, 0.705304, 0.208323],
[0.963241, 0.714552, 0.219998],
[0.959226, 0.723757, 0.232344],
[0.955074, 0.732911, 0.245336],
[0.950803, 0.742006, 0.258945],
[0.946427, 0.751030, 0.273142],
[0.941968, 0.759975, 0.287896],
[0.937448, 0.768829, 0.303181],
[0.932891, 0.777582, 0.318965],
[0.928325, 0.786224, 0.335223],
[0.923779, 0.794743, 0.351926],
[0.919283, 0.803129, 0.369047],
[0.914871, 0.811371, 0.386559],
[0.910577, 0.819459, 0.404432],
[0.906436, 0.827383, 0.422639],
[0.902487, 0.835134, 0.441152],
[0.898759, 0.842704, 0.459987],
[0.895294, 0.850082, 0.479105],
[0.892134, 0.857261, 0.498470],
[0.889318, 0.864233, 0.518042],
[0.886886, 0.870991, 0.537780],
[0.884875, 0.877530, 0.557645],
[0.883321, 0.883846, 0.577597],
[0.882257, 0.889936, 0.597597],
[0.881713, 0.895798, 0.617602],
[0.881714, 0.901431, 0.637574],
[0.882282, 0.906837, 0.657473],
[0.883436, 0.912016, 0.677259],
[0.885187, 0.916972, 0.696895],
[0.887543, 0.921709, 0.716342],
[0.890507, 0.926235, 0.735552],
[0.894073, 0.930557, 0.754481],
[0.898231, 0.934686, 0.773086],
[0.902966, 0.938633, 0.791328],
[0.908258, 0.942411, 0.809170],
[0.914080, 0.946032, 0.826578],
[0.920403, 0.949512, 0.843518],
[0.927194, 0.952867, 0.859963],
[0.934416, 0.956113, 0.875885],
[0.942028, 0.959268, 0.891258],
[0.949987, 0.962353, 0.906058],
[0.958246, 0.965388, 0.920259],
[0.966750, 0.968397, 0.933834],
[0.975437, 0.971411, 0.946745],
[0.984224, 0.974469, 0.958931],
[0.992967, 0.977648, 0.970244],
[1.000000, 0.981264, 0.979916],
]
from matplotlib.colors import ListedColormap
import matplotlib.pyplot as plt
import numpy as np
from cm_audaspec import audaspec_data
auda_cm = ListedColormap(audaspec_data, name='AudaSpec')
plt.imshow(np.linspace(0, 100, 256)[None, :], aspect='auto', cmap=auda_cm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment