I wanted to do some shading in a table according to its values. For example, if you see the table below:
a b c d
a 90 10 0 0
b 0 80 10 10
c 0 0 95 5
d 0 10 5 85
I want to shade automatically each numeric cell with a mixture of black and white according to its value. That is, (a,a) = 90 should be something like black!90, and (c,d) = 5 should be black!5. Also, if you can parametrized the shading operation so one can define the color and if we use the value or the complement that would be great.
I was thinking in something like Drawing different tikz shapes parameterized by data from a file, but I cannot see how can one achieve that in a table.
Can you give me some advice on how to achieve such automatic styling?




\pgfplotstabletypesetinside a table environment (\begin{table} ... \end{table}) I get aNot in outer par modeerror. So, is there any option to put that table in an environment? so I can add a caption to it, and style as other tables in my document? – adn Jan 27 '12 at 06:25standaloneclass. In "normal" classes, you should be able to use thetableenvironment. I've edited my example. – Jake Jan 27 '12 at 06:35standalone, too. The numbers look like they're too far up because there's space left for the descender of letters likeg,j, orq. If you add\rule{0cm}{2.4ex}before\cellcolor, they'll loke more centered. – Jake Jan 27 '12 at 06:49##1by\pgftruncatemacro##1,\pgftruncatemacro{##1},\pgfmathparse{round(##1)}; but none of those work. I'm not very familiar with pgf, sorry for being this pushing. – adn Jan 27 '12 at 06:56\pgfmathtruncatemacro\somemacroname{##1}. You need to save the result into a macro, the command doesn't change the content of##1itself. – Jake Jan 27 '12 at 06:59