I would like to generate ArrayPlot
from data below
values = {1534, 1404, 1484, 1564, 1414, 1464, 1534, 1454, 1414, 1444,
1584, 1534, 1604, 1474, 1554, 1484, 1414, 1484, 1604, 1474, 1484,
1826, 1856, 1806, 1916, 1826, 1786, 1906, 1846, 584, 724, 544, 644,
1409, 1309, 1659, 1389, 1359, 1389, 2400, 1389, 2400, 2650, 3550,
3550, 3500, 1409, 1289, 1559, 1409, 1609, 1409, 1339, 1409, 1609,
2874, 1609, 4000, 4450, 4000, 3770, 4000, 2500, 2650};
mat = Partition[values, 8, 8];
However, only values running from 1000-5000
should be plotted.
colours = Reverse[{Red, Yellow, Green, Cyan, Blue, Magenta}];
z1bound = 1000;
z2bound = 5000;
colourfunc =
Function[Blend[Reverse[{Red, Yellow, Green, Cyan, Blue, Magenta}],
Rescale[#, {z1bound, z2bound}]]];
Values outside this interval, such as 584,724,544,644
should be excluded from an ArrayPlot
(e.g. plotted in a white colour). I have rescaled my colourfunc
in this way but the above-mentioned values are plotted in the ArrayPlot
anyway (in a Magenta colour).
arrayplot =
ArrayPlot[mat, ColorFunction -> colourfunc,
ColorFunctionScaling -> False,
PlotLegends -> BarLegend[{colourfunc, {z1bound, z2bound}}],
Epilog -> {Black,
MapIndexed[Text[#1, Reverse[#2 - 1/2]] &, Reverse[mat], {2}]}]
I will be grateful for any help.
Clip[mat, {1000, 5000}, {White, White}]
$\endgroup$1000
(Magenta
) to5000
(Red
). I made a mistake in that previous comment. $\endgroup$