# What is the default ColorFunction for MatrixPlot?

I think the the default ColorFunction for ArrayPlot is ColorNegate[RGBColor[{#, #, #}]] & (where 0 <= # <= 1):

But I can't figure out the default ColorFunction for MatrixPlot, so could anyone give me some hint?

PS:

What I want to do is to modify the default ColorFunction of MatrixPlot a little, so I should find its RGB function first (in my opinion).

OK, this turns out to be version related. Based on the experience from this post:

## In v9.0.1 or earlier

After some trial and error, I obtain:

colorFunctionMatrixPlot =
Trace[MatrixPlot@{{1}}, _[Blend[__]] &] // Flatten // First // ReleaseHold

Quiet[Blend[{{0., RGBColor[0.260487, 0.136843, 0.891569]}, {0.166667,
RGBColor[0.230198, 0.499962, 0.848188]}, {0.333333,
RGBColor[0.392401, 0.658762, 0.797589]}, {0.499999,
RGBColor[0.648371, 0.823316, 0.898802]}, {0.5, GrayLevel[1]}, {0.500001,
RGBColor[0.857832, 0.857603, 0.654231]}, {0.666667,
RGBColor[0.913252, 0.790646, 0.462837]}, {0.833333,
RGBColor[0.860243, 0.558831, 0.00695811]}, {1, RGBColor[1., 0.43125, 0.]}}, #1]] &

MatrixPlot[{{1, 2, 1}, {3, 0, 1}, {0, 0, -1}}, ColorFunction -> colorFunctionMatrixPlot]


## In v10

colorFunctionMatrixPlot =
Trace[MatrixPlot@{{1}}, Blend[__]&] // Flatten // First // ReleaseHold;
colorFunctionMatrixPlot[[1, 1]] = colorFunctionMatrixPlot[[1, 1]];
colorFunctionMatrixPlot

Blend[{{0., RGBColor[0.260487, 0.356, 0.891569]}, {0.166667,
RGBColor[0.230198, 0.499962, 0.848188]}, {0.333333,
RGBColor[0.392401, 0.658762, 0.797589]}, {0.499999,
RGBColor[0.964837, 0.982332, 0.98988]}, {0.5, RGBColor[1, 1, 1]}, {0.500001,
RGBColor[0.95735, 0.957281, 0.896269]}, {0.666667,
RGBColor[0.913252, 0.790646, 0.462837]}, {0.833333,
RGBColor[0.860243, 0.558831, 0.00695811]}, {1., RGBColor[1., 0.42, 0.]}}, #1] &


Notice the color scheme has been changed a bit. See the comments below for more details.

• I'm fresh to Mathematica. Could you please give me a example about how to call your ColorFunction in MatrixPlot? – Sayakiss Jan 14 '16 at 12:12
• When I input your definition for colorFunctionMatrixPlot, what I get back is First::nofirst: {} has zero length and no first element. >>. The result of Trace[MatrixPlot@{{1}}, Quiet[Blend[__]] &] is simply {} – Jason B. Jan 14 '16 at 12:17
• @JasonB Can this be related to the version? I'm in v9.0.1. What if you try pattern Blend[__] & instead? – xzczd Jan 14 '16 at 12:19
• Removing the Quiet fixed it. It now returns Blend[SystemPlotThemeDump\$ThemeDefaultMatrix, #1] & (using version 10.3) – Jason B. Jan 14 '16 at 12:21
• Interestingly, the color scheme changed a little bit, the color for zero in my version is RGBColor[0.260487, 0.356, 0.891569] which is a teensy bit lighter than your output above – Jason B. Jan 14 '16 at 12:23