Hello and have a nice day!
I need to make MatrixPlot for some data. Here you can find a notebook with preprocessing raw data and some functions from below text.
I want all "Inf" values to be colored white, those greater than 13 to be black, and for the rest a color gradient will be applied, and in the full range, and not in half.
When I use
ColorRules -> {x_ /; x === Infinity -> White, x_ /; 13 < x -> Black }
it goes wrong
because range should be bigger
The problem doesn't solved by writing customize ColorFunction:
myColorData[c_] := Function[Which[
# === Infinity, White,
# > 13, Black,
True, ColorData[c][N@##]
]];
with calling
MatrixPlot[Flatten[bottleneck, 1], PlotRange -> {0, 13},ColorFunction -> (myColorData["ThermometerColors"][##] &), ColorFunctionScaling -> False]
Thank you! With respect!
ColorFunctionScaling
, you need to manually rescale. Try...ColorRules -> {\[Infinity] -> White, x_ /; x > 13 -> Black}, ColorFunction -> (ColorData["Rainbow"][Rescale[N@#, {Min@Flatten@bottleneck, 13}, {0, 1}]] &), ColorFunctionScaling -> False...
$\endgroup$