# ArrayPlot of square matrix: how does ColorFunction -> Automatic work?

Suppose you have the following:

tt = Table[{i, j}, {i, 0, 10}, {j, 0, 10}]


The table tt is a matrix of pairs, {i, j}. Now you issue

ArrayPlot[tt]


you get a nice image with the top row and the rightmost column white.

How does ArrayPlot work in this case? I tried to look into the ColorFunction documentation but I was not able to actually understand how the system is working. I am curious to find an explanation.

-

In this case GrayLevel[g,a] is used where a is the alpha-value. You can see this easily by drawing a rectangle below your plot:

tt = Table[{i, j}, {i, 0, 10}, {j, 0, 10}];
Show[Graphics[{Red, Rectangle[{0, 0}, {11, 11}]}],
ArrayPlot[tt]
]


As suggested by Kuba here an additional example:

Row[{ArrayPlot[tt], ArrayPlot[tt, ColorFunction -> (GrayLevel[1-#] &)]}]


And finally, ArrayPlot creates a Raster and this information can be found under Scope -> Raster Styling section.

-
Thanks. That was very helpful. Took me a bit more, but I think I grokked it. There should be a bit more of explanation directly in the ArrayPlot documentation. –  Marco Antoniotti Jun 6 at 12:32