Skip to content
Snippets Groups Projects

RangeUtils: Added MPL Inferno as default color gradient

Merged Ludwig Jaeck requested to merge 273-inferno into main
All threads resolved!
@@ -171,64 +171,262 @@ GUI::View::RangeUtils::valueAxesFromIntensityItems(const QList<IntensityDataItem
// github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/_cm_listed.py
QCPColorGradient GUI::View::RangeUtils::colorGradientInferno()
{
QVector<QColor> infernoColors = {
{0, 0, 3}, {0, 0, 4}, {0, 0, 6}, {1, 0, 7}, {1, 1, 9},
{1, 1, 11}, {2, 1, 14}, {2, 2, 16}, {3, 2, 18}, {4, 3, 20},
{4, 3, 22}, {5, 4, 24}, {6, 4, 27}, {7, 5, 29}, {8, 6, 31},
{9, 6, 33}, {10, 7, 35}, {11, 7, 38}, {13, 8, 40}, {14, 8, 42},
{15, 9, 45}, {16, 9, 47}, {18, 10, 50}, {19, 10, 52}, {20, 11, 54},
{22, 11, 57}, {23, 11, 59}, {25, 11, 62}, {26, 11, 64}, {28, 12, 67},
{29, 12, 69}, {31, 12, 71}, {32, 12, 74}, {34, 11, 76}, {36, 11, 78},
{38, 11, 80}, {39, 11, 82}, {41, 11, 84}, {43, 10, 86}, {45, 10, 88},
{46, 10, 90}, {48, 10, 92}, {50, 9, 93}, {52, 9, 95}, {53, 9, 96},
{55, 9, 97}, {57, 9, 98}, {59, 9, 100}, {60, 9, 101}, {62, 9, 102},
{64, 9, 102}, {65, 9, 103}, {67, 10, 104}, {69, 10, 105}, {70, 10, 105},
{72, 11, 106}, {74, 11, 106}, {75, 12, 107}, {77, 12, 107}, {79, 13, 108},
{80, 13, 108}, {82, 14, 108}, {83, 14, 109}, {85, 15, 109}, {87, 15, 109},
{88, 16, 109}, {90, 17, 109}, {91, 17, 110}, {93, 18, 110}, {95, 18, 110},
{96, 19, 110}, {98, 20, 110}, {99, 20, 110}, {101, 21, 110}, {102, 21, 110},
{104, 22, 110}, {106, 23, 110}, {107, 23, 110}, {109, 24, 110}, {110, 24, 110},
{112, 25, 110}, {114, 25, 109}, {115, 26, 109}, {117, 27, 109}, {118, 27, 109},
{120, 28, 109}, {122, 28, 109}, {123, 29, 108}, {125, 29, 108}, {126, 30, 108},
{128, 31, 107}, {129, 31, 107}, {131, 32, 107}, {133, 32, 106}, {134, 33, 106},
{136, 33, 106}, {137, 34, 105}, {139, 34, 105}, {141, 35, 105}, {142, 36, 104},
{144, 36, 104}, {145, 37, 103}, {147, 37, 103}, {149, 38, 102}, {150, 38, 102},
{152, 39, 101}, {153, 40, 100}, {155, 40, 100}, {156, 41, 99}, {158, 41, 99},
{160, 42, 98}, {161, 43, 97}, {163, 43, 97}, {164, 44, 96}, {166, 44, 95},
{167, 45, 95}, {169, 46, 94}, {171, 46, 93}, {172, 47, 92}, {174, 48, 91},
{175, 49, 91}, {177, 49, 90}, {178, 50, 89}, {180, 51, 88}, {181, 51, 87},
{183, 52, 86}, {184, 53, 86}, {186, 54, 85}, {187, 55, 84}, {189, 55, 83},
{190, 56, 82}, {191, 57, 81}, {193, 58, 80}, {194, 59, 79}, {196, 60, 78},
{197, 61, 77}, {199, 62, 76}, {200, 62, 75}, {201, 63, 74}, {203, 64, 73},
{204, 65, 72}, {205, 66, 71}, {207, 68, 70}, {208, 69, 68}, {209, 70, 67},
{210, 71, 66}, {212, 72, 65}, {213, 73, 64}, {214, 74, 63}, {215, 75, 62},
{217, 77, 61}, {218, 78, 59}, {219, 79, 58}, {220, 80, 57}, {221, 82, 56},
{222, 83, 55}, {223, 84, 54}, {224, 86, 52}, {226, 87, 51}, {227, 88, 50},
{228, 90, 49}, {229, 91, 48}, {230, 92, 46}, {230, 94, 45}, {231, 95, 44},
{232, 97, 43}, {233, 98, 42}, {234, 100, 40}, {235, 101, 39}, {236, 103, 38},
{237, 104, 37}, {237, 106, 35}, {238, 108, 34}, {239, 109, 33}, {240, 111, 31},
{240, 112, 30}, {241, 114, 29}, {242, 116, 28}, {242, 117, 26}, {243, 119, 25},
{243, 121, 24}, {244, 122, 22}, {245, 124, 21}, {245, 126, 20}, {246, 128, 18},
{246, 129, 17}, {247, 131, 16}, {247, 133, 14}, {248, 135, 13}, {248, 136, 12},
{248, 138, 11}, {249, 140, 9}, {249, 142, 8}, {249, 144, 8}, {250, 145, 7},
{250, 147, 6}, {250, 149, 6}, {250, 151, 6}, {251, 153, 6}, {251, 155, 6},
{251, 157, 6}, {251, 158, 7}, {251, 160, 7}, {251, 162, 8}, {251, 164, 10},
{251, 166, 11}, {251, 168, 13}, {251, 170, 14}, {251, 172, 16}, {251, 174, 18},
{251, 176, 20}, {251, 177, 22}, {251, 179, 24}, {251, 181, 26}, {251, 183, 28},
{251, 185, 30}, {250, 187, 33}, {250, 189, 35}, {250, 191, 37}, {250, 193, 40},
{249, 195, 42}, {249, 197, 44}, {249, 199, 47}, {248, 201, 49}, {248, 203, 52},
{248, 205, 55}, {247, 207, 58}, {247, 209, 60}, {246, 211, 63}, {246, 213, 66},
{245, 215, 69}, {245, 217, 72}, {244, 219, 75}, {244, 220, 79}, {243, 222, 82},
{243, 224, 86}, {243, 226, 89}, {242, 228, 93}, {242, 230, 96}, {241, 232, 100},
{241, 233, 104}, {241, 235, 108}, {241, 237, 112}, {241, 238, 116}, {241, 240, 121},
{241, 242, 125}, {242, 243, 129}, {242, 244, 133}, {243, 246, 137}, {244, 247, 141},
{245, 248, 145}, {246, 250, 149}, {247, 251, 153}, {249, 252, 157}, {250, 253, 160},
{252, 254, 164},
};
QCPColorGradient result;
for (int i = 0; i < infernoColors.size(); ++i) {
result.setColorStopAt(double(i) / 255.0, infernoColors[i]);
}
result.setColorStopAt(0.0, {0, 0, 3});
result.setColorStopAt(0.00392156862745098, {0, 0, 4});
result.setColorStopAt(0.00784313725490196, {0, 0, 6});
result.setColorStopAt(0.011764705882352941, {1, 0, 7});
result.setColorStopAt(0.01568627450980392, {1, 1, 9});
result.setColorStopAt(0.0196078431372549, {1, 1, 11});
result.setColorStopAt(0.023529411764705882, {2, 1, 14});
result.setColorStopAt(0.027450980392156862, {2, 2, 16});
result.setColorStopAt(0.03137254901960784, {3, 2, 18});
result.setColorStopAt(0.03529411764705882, {4, 3, 20});
result.setColorStopAt(0.0392156862745098, {4, 3, 22});
result.setColorStopAt(0.043137254901960784, {5, 4, 24});
result.setColorStopAt(0.047058823529411764, {6, 4, 27});
result.setColorStopAt(0.050980392156862744, {7, 5, 29});
result.setColorStopAt(0.054901960784313725, {8, 6, 31});
result.setColorStopAt(0.058823529411764705, {9, 6, 33});
result.setColorStopAt(0.06274509803921569, {10, 7, 35});
result.setColorStopAt(0.06666666666666667, {11, 7, 38});
result.setColorStopAt(0.07058823529411765, {13, 8, 40});
result.setColorStopAt(0.07450980392156863, {14, 8, 42});
result.setColorStopAt(0.0784313725490196, {15, 9, 45});
result.setColorStopAt(0.08235294117647059, {16, 9, 47});
result.setColorStopAt(0.08627450980392157, {18, 10, 50});
result.setColorStopAt(0.09019607843137255, {19, 10, 52});
result.setColorStopAt(0.09411764705882353, {20, 11, 54});
result.setColorStopAt(0.09803921568627451, {22, 11, 57});
result.setColorStopAt(0.10196078431372549, {23, 11, 59});
result.setColorStopAt(0.10588235294117647, {25, 11, 62});
result.setColorStopAt(0.10980392156862745, {26, 11, 64});
result.setColorStopAt(0.11372549019607843, {28, 12, 67});
result.setColorStopAt(0.11764705882352941, {29, 12, 69});
result.setColorStopAt(0.12156862745098039, {31, 12, 71});
result.setColorStopAt(0.12549019607843137, {32, 12, 74});
result.setColorStopAt(0.12941176470588237, {34, 11, 76});
result.setColorStopAt(0.13333333333333333, {36, 11, 78});
result.setColorStopAt(0.13725490196078433, {38, 11, 80});
result.setColorStopAt(0.1411764705882353, {39, 11, 82});
result.setColorStopAt(0.1450980392156863, {41, 11, 84});
result.setColorStopAt(0.14901960784313725, {43, 10, 86});
result.setColorStopAt(0.15294117647058825, {45, 10, 88});
result.setColorStopAt(0.1568627450980392, {46, 10, 90});
result.setColorStopAt(0.1607843137254902, {48, 10, 92});
result.setColorStopAt(0.16470588235294117, {50, 9, 93});
result.setColorStopAt(0.16862745098039217, {52, 9, 95});
result.setColorStopAt(0.17254901960784313, {53, 9, 96});
result.setColorStopAt(0.17647058823529413, {55, 9, 97});
result.setColorStopAt(0.1803921568627451, {57, 9, 98});
result.setColorStopAt(0.1843137254901961, {59, 9, 100});
result.setColorStopAt(0.18823529411764706, {60, 9, 101});
result.setColorStopAt(0.19215686274509805, {62, 9, 102});
result.setColorStopAt(0.19607843137254902, {64, 9, 102});
result.setColorStopAt(0.2, {65, 9, 103});
result.setColorStopAt(0.20392156862745098, {67, 10, 104});
result.setColorStopAt(0.20784313725490197, {69, 10, 105});
result.setColorStopAt(0.21176470588235294, {70, 10, 105});
result.setColorStopAt(0.21568627450980393, {72, 11, 106});
result.setColorStopAt(0.2196078431372549, {74, 11, 106});
result.setColorStopAt(0.2235294117647059, {75, 12, 107});
result.setColorStopAt(0.22745098039215686, {77, 12, 107});
result.setColorStopAt(0.23137254901960785, {79, 13, 108});
result.setColorStopAt(0.23529411764705882, {80, 13, 108});
result.setColorStopAt(0.23921568627450981, {82, 14, 108});
result.setColorStopAt(0.24313725490196078, {83, 14, 109});
result.setColorStopAt(0.24705882352941178, {85, 15, 109});
result.setColorStopAt(0.25098039215686274, {87, 15, 109});
result.setColorStopAt(0.2549019607843137, {88, 16, 109});
result.setColorStopAt(0.25882352941176473, {90, 17, 109});
result.setColorStopAt(0.2627450980392157, {91, 17, 110});
result.setColorStopAt(0.26666666666666666, {93, 18, 110});
result.setColorStopAt(0.27058823529411763, {95, 18, 110});
result.setColorStopAt(0.27450980392156865, {96, 19, 110});
result.setColorStopAt(0.2784313725490196, {98, 20, 110});
result.setColorStopAt(0.2823529411764706, {99, 20, 110});
result.setColorStopAt(0.28627450980392155, {101, 21, 110});
result.setColorStopAt(0.2901960784313726, {102, 21, 110});
result.setColorStopAt(0.29411764705882354, {104, 22, 110});
result.setColorStopAt(0.2980392156862745, {106, 23, 110});
result.setColorStopAt(0.30196078431372547, {107, 23, 110});
result.setColorStopAt(0.3058823529411765, {109, 24, 110});
result.setColorStopAt(0.30980392156862746, {110, 24, 110});
result.setColorStopAt(0.3137254901960784, {112, 25, 110});
result.setColorStopAt(0.3176470588235294, {114, 25, 109});
result.setColorStopAt(0.3215686274509804, {115, 26, 109});
result.setColorStopAt(0.3254901960784314, {117, 27, 109});
result.setColorStopAt(0.32941176470588235, {118, 27, 109});
result.setColorStopAt(0.3333333333333333, {120, 28, 109});
result.setColorStopAt(0.33725490196078434, {122, 28, 109});
result.setColorStopAt(0.3411764705882353, {123, 29, 108});
result.setColorStopAt(0.34509803921568627, {125, 29, 108});
result.setColorStopAt(0.34901960784313724, {126, 30, 108});
result.setColorStopAt(0.35294117647058826, {128, 31, 107});
result.setColorStopAt(0.3568627450980392, {129, 31, 107});
result.setColorStopAt(0.3607843137254902, {131, 32, 107});
result.setColorStopAt(0.36470588235294116, {133, 32, 106});
result.setColorStopAt(0.3686274509803922, {134, 33, 106});
result.setColorStopAt(0.37254901960784315, {136, 33, 106});
result.setColorStopAt(0.3764705882352941, {137, 34, 105});
result.setColorStopAt(0.3803921568627451, {139, 34, 105});
result.setColorStopAt(0.3843137254901961, {141, 35, 105});
result.setColorStopAt(0.38823529411764707, {142, 36, 104});
result.setColorStopAt(0.39215686274509803, {144, 36, 104});
result.setColorStopAt(0.396078431372549, {145, 37, 103});
result.setColorStopAt(0.4, {147, 37, 103});
result.setColorStopAt(0.403921568627451, {149, 38, 102});
result.setColorStopAt(0.40784313725490196, {150, 38, 102});
result.setColorStopAt(0.4117647058823529, {152, 39, 101});
result.setColorStopAt(0.41568627450980394, {153, 40, 100});
result.setColorStopAt(0.4196078431372549, {155, 40, 100});
result.setColorStopAt(0.4235294117647059, {156, 41, 99});
result.setColorStopAt(0.42745098039215684, {158, 41, 99});
result.setColorStopAt(0.43137254901960786, {160, 42, 98});
result.setColorStopAt(0.43529411764705883, {161, 43, 97});
result.setColorStopAt(0.4392156862745098, {163, 43, 97});
result.setColorStopAt(0.44313725490196076, {164, 44, 96});
result.setColorStopAt(0.4470588235294118, {166, 44, 95});
result.setColorStopAt(0.45098039215686275, {167, 45, 95});
result.setColorStopAt(0.4549019607843137, {169, 46, 94});
result.setColorStopAt(0.4588235294117647, {171, 46, 93});
result.setColorStopAt(0.4627450980392157, {172, 47, 92});
result.setColorStopAt(0.4666666666666667, {174, 48, 91});
result.setColorStopAt(0.47058823529411764, {175, 49, 91});
result.setColorStopAt(0.4745098039215686, {177, 49, 90});
result.setColorStopAt(0.47843137254901963, {178, 50, 89});
result.setColorStopAt(0.4823529411764706, {180, 51, 88});
result.setColorStopAt(0.48627450980392156, {181, 51, 87});
result.setColorStopAt(0.49019607843137253, {183, 52, 86});
result.setColorStopAt(0.49411764705882355, {184, 53, 86});
result.setColorStopAt(0.4980392156862745, {186, 54, 85});
result.setColorStopAt(0.5019607843137255, {187, 55, 84});
result.setColorStopAt(0.5058823529411764, {189, 55, 83});
result.setColorStopAt(0.5098039215686274, {190, 56, 82});
result.setColorStopAt(0.5137254901960784, {191, 57, 81});
result.setColorStopAt(0.5176470588235295, {193, 58, 80});
result.setColorStopAt(0.5215686274509804, {194, 59, 79});
result.setColorStopAt(0.5254901960784314, {196, 60, 78});
result.setColorStopAt(0.5294117647058824, {197, 61, 77});
result.setColorStopAt(0.5333333333333333, {199, 62, 76});
result.setColorStopAt(0.5372549019607843, {200, 62, 75});
result.setColorStopAt(0.5411764705882353, {201, 63, 74});
result.setColorStopAt(0.5450980392156862, {203, 64, 73});
result.setColorStopAt(0.5490196078431373, {204, 65, 72});
result.setColorStopAt(0.5529411764705883, {205, 66, 71});
result.setColorStopAt(0.5568627450980392, {207, 68, 70});
result.setColorStopAt(0.5607843137254902, {208, 69, 68});
result.setColorStopAt(0.5647058823529412, {209, 70, 67});
result.setColorStopAt(0.5686274509803921, {210, 71, 66});
result.setColorStopAt(0.5725490196078431, {212, 72, 65});
result.setColorStopAt(0.5764705882352941, {213, 73, 64});
result.setColorStopAt(0.5803921568627451, {214, 74, 63});
result.setColorStopAt(0.5843137254901961, {215, 75, 62});
result.setColorStopAt(0.5882352941176471, {217, 77, 61});
result.setColorStopAt(0.592156862745098, {218, 78, 59});
result.setColorStopAt(0.596078431372549, {219, 79, 58});
result.setColorStopAt(0.6, {220, 80, 57});
result.setColorStopAt(0.6039215686274509, {221, 82, 56});
result.setColorStopAt(0.6078431372549019, {222, 83, 55});
result.setColorStopAt(0.611764705882353, {223, 84, 54});
result.setColorStopAt(0.615686274509804, {224, 86, 52});
result.setColorStopAt(0.6196078431372549, {226, 87, 51});
result.setColorStopAt(0.6235294117647059, {227, 88, 50});
result.setColorStopAt(0.6274509803921569, {228, 90, 49});
result.setColorStopAt(0.6313725490196078, {229, 91, 48});
result.setColorStopAt(0.6352941176470588, {230, 92, 46});
result.setColorStopAt(0.6392156862745098, {230, 94, 45});
result.setColorStopAt(0.6431372549019608, {231, 95, 44});
result.setColorStopAt(0.6470588235294118, {232, 97, 43});
result.setColorStopAt(0.6509803921568628, {233, 98, 42});
result.setColorStopAt(0.6549019607843137, {234, 100, 40});
result.setColorStopAt(0.6588235294117647, {235, 101, 39});
result.setColorStopAt(0.6627450980392157, {236, 103, 38});
result.setColorStopAt(0.6666666666666666, {237, 104, 37});
result.setColorStopAt(0.6705882352941176, {237, 106, 35});
result.setColorStopAt(0.6745098039215687, {238, 108, 34});
result.setColorStopAt(0.6784313725490196, {239, 109, 33});
result.setColorStopAt(0.6823529411764706, {240, 111, 31});
result.setColorStopAt(0.6862745098039216, {240, 112, 30});
result.setColorStopAt(0.6901960784313725, {241, 114, 29});
result.setColorStopAt(0.6941176470588235, {242, 116, 28});
result.setColorStopAt(0.6980392156862745, {242, 117, 26});
result.setColorStopAt(0.7019607843137254, {243, 119, 25});
result.setColorStopAt(0.7058823529411765, {243, 121, 24});
result.setColorStopAt(0.7098039215686275, {244, 122, 22});
result.setColorStopAt(0.7137254901960784, {245, 124, 21});
result.setColorStopAt(0.7176470588235294, {245, 126, 20});
result.setColorStopAt(0.7215686274509804, {246, 128, 18});
result.setColorStopAt(0.7254901960784313, {246, 129, 17});
result.setColorStopAt(0.7294117647058823, {247, 131, 16});
result.setColorStopAt(0.7333333333333333, {247, 133, 14});
result.setColorStopAt(0.7372549019607844, {248, 135, 13});
result.setColorStopAt(0.7411764705882353, {248, 136, 12});
result.setColorStopAt(0.7450980392156863, {248, 138, 11});
result.setColorStopAt(0.7490196078431373, {249, 140, 9});
result.setColorStopAt(0.7529411764705882, {249, 142, 8});
result.setColorStopAt(0.7568627450980392, {249, 144, 8});
result.setColorStopAt(0.7607843137254902, {250, 145, 7});
result.setColorStopAt(0.7647058823529411, {250, 147, 6});
result.setColorStopAt(0.7686274509803922, {250, 149, 6});
result.setColorStopAt(0.7725490196078432, {250, 151, 6});
result.setColorStopAt(0.7764705882352941, {251, 153, 6});
result.setColorStopAt(0.7803921568627451, {251, 155, 6});
result.setColorStopAt(0.7843137254901961, {251, 157, 6});
result.setColorStopAt(0.788235294117647, {251, 158, 7});
result.setColorStopAt(0.792156862745098, {251, 160, 7});
result.setColorStopAt(0.796078431372549, {251, 162, 8});
result.setColorStopAt(0.8, {251, 164, 10});
result.setColorStopAt(0.803921568627451, {251, 166, 11});
result.setColorStopAt(0.807843137254902, {251, 168, 13});
result.setColorStopAt(0.8117647058823529, {251, 170, 14});
result.setColorStopAt(0.8156862745098039, {251, 172, 16});
result.setColorStopAt(0.8196078431372549, {251, 174, 18});
result.setColorStopAt(0.8235294117647058, {251, 176, 20});
result.setColorStopAt(0.8274509803921568, {251, 177, 22});
result.setColorStopAt(0.8313725490196079, {251, 179, 24});
result.setColorStopAt(0.8352941176470589, {251, 181, 26});
result.setColorStopAt(0.8392156862745098, {251, 183, 28});
result.setColorStopAt(0.8431372549019608, {251, 185, 30});
result.setColorStopAt(0.8470588235294118, {250, 187, 33});
result.setColorStopAt(0.8509803921568627, {250, 189, 35});
result.setColorStopAt(0.8549019607843137, {250, 191, 37});
result.setColorStopAt(0.8588235294117647, {250, 193, 40});
result.setColorStopAt(0.8627450980392157, {249, 195, 42});
result.setColorStopAt(0.8666666666666667, {249, 197, 44});
result.setColorStopAt(0.8705882352941177, {249, 199, 47});
result.setColorStopAt(0.8745098039215686, {248, 201, 49});
result.setColorStopAt(0.8784313725490196, {248, 203, 52});
result.setColorStopAt(0.8823529411764706, {248, 205, 55});
result.setColorStopAt(0.8862745098039215, {247, 207, 58});
result.setColorStopAt(0.8901960784313725, {247, 209, 60});
result.setColorStopAt(0.8941176470588236, {246, 211, 63});
result.setColorStopAt(0.8980392156862745, {246, 213, 66});
result.setColorStopAt(0.9019607843137255, {245, 215, 69});
result.setColorStopAt(0.9058823529411765, {245, 217, 72});
result.setColorStopAt(0.9098039215686274, {244, 219, 75});
result.setColorStopAt(0.9137254901960784, {244, 220, 79});
result.setColorStopAt(0.9176470588235294, {243, 222, 82});
result.setColorStopAt(0.9215686274509803, {243, 224, 86});
result.setColorStopAt(0.9254901960784314, {243, 226, 89});
result.setColorStopAt(0.9294117647058824, {242, 228, 93});
result.setColorStopAt(0.9333333333333333, {242, 230, 96});
result.setColorStopAt(0.9372549019607843, {241, 232, 100});
result.setColorStopAt(0.9411764705882353, {241, 233, 104});
result.setColorStopAt(0.9450980392156862, {241, 235, 108});
result.setColorStopAt(0.9490196078431372, {241, 237, 112});
result.setColorStopAt(0.9529411764705882, {241, 238, 116});
result.setColorStopAt(0.9568627450980393, {241, 240, 121});
result.setColorStopAt(0.9607843137254902, {241, 242, 125});
result.setColorStopAt(0.9647058823529412, {242, 243, 129});
result.setColorStopAt(0.9686274509803922, {242, 244, 133});
result.setColorStopAt(0.9725490196078431, {243, 246, 137});
result.setColorStopAt(0.9764705882352941, {244, 247, 141});
result.setColorStopAt(0.9803921568627451, {245, 248, 145});
result.setColorStopAt(0.984313725490196, {246, 250, 149});
result.setColorStopAt(0.9882352941176471, {247, 251, 153});
result.setColorStopAt(0.9921568627450981, {249, 252, 157});
result.setColorStopAt(0.996078431372549, {250, 253, 160});
result.setColorStopAt(1.0, {252, 254, 164});
return result;
}
Loading