3
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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]
]

Mathematica graphics

As suggested by Kuba here an additional example:

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

Mathematica graphics

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

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Marco Antoniotti Jun 6 '14 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.