This is in the docs* and might be what you want:
(* the catch is you have to know that this is what you need to be able to find it in the docs -- it is not necessarily intuitive for a new user to go to array plot for this solution)
or you can blend between two colours:
ArrayPlot[RandomReal[1, {10, 20}], ColorFunction -> (Blend[{Yellow, Purple}, #1] &)]
or make a binary choice:
ArrayPlot[{{0., 2.03181, 10.9162, 9.81852, 19.9333, 9.74689, 0.826292,
1.61575, 6.11642}, {2.52762, 0., 12.3072, 13.0194, 5.9971,
20.1544, 2.1197, 0.611078, 5.01625}, {17.5098, 6.42256, 0.,
5.32809, 7.09947, 22.5269, 5.43391, 5.56034, 0.48698}},
ColorFunction -> (If[#1 > 10, Purple, Yellow] &),
ColorFunctionScaling -> False]
ColorFunctionScaling
is an option that by default is True
and means that the values in your list are scaled. There may be occasions where you want to apply your own scaling function. You would do this as a pure function for ColorFunction
.
Here is default scaling using a "wimbledon" gradient (green-purple)
ArrayPlot[{{0., 2.03181, 10.9162, 9.81852, 19.9333, 9.74689, 0.826292,
1.61575, 6.11642}, {2.52762, 0., 12.3072, 13.0194, 5.9971,
20.1544, 2.1197, 0.611078, 5.01625}, {17.5098, 6.42256, 0.,
5.32809, 7.09947, 22.5269, 5.43391, 5.56034, 0.48698}},
ColorFunction -> (Blend[{Green, Purple}, #1] &),
ColorFunctionScaling -> True]
Here is a new plot, this time scaling your numbers between 0 and 40.
ArrayPlot[{{0., 2.03181, 10.9162, 9.81852, 19.9333, 9.74689, 0.826292,
1.61575, 6.11642}, {2.52762, 0., 12.3072, 13.0194, 5.9971,
20.1544, 2.1197, 0.611078, 5.01625}, {17.5098, 6.42256, 0.,
5.32809, 7.09947, 22.5269, 5.43391, 5.56034, 0.48698}},
ColorFunction -> (Blend[{Green, Purple}, Rescale[#1, {0, 40}]] &),
ColorFunctionScaling -> False]