Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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