# Table vs Plot: How to print table of values, with colors representing values

In an effort to collect knowledge that will ultimately allow me to answer this question, I am seeking a way to generate a table where numeric values are plotted as cell-filling colors. The color should represent the number.
N.B.: I am not trying to repost the question I mentioned above. Here I am asking for a way to approach merely a subset of that question.

A rendering of my MWE below:

So far, I have been trying to achieve this using pgfplots (inspired by this answer), but there are some drawbacks in the measuring department:
I'd have to do all the math by hand, in order to make sure all rows and columns align nicely (see MWE). Additionally, styling tick labels with alternating styles will be tough, as a PGFplot is not entirely built to do that. And on top of that, adding meta-labels in order to group tick labels (see other question) is probably going to be impossible.

In a nutshell, the approach I have so far (using PGFplots) is not ideal, since what I want is to draw a table. But then, tables don't have these powerful ways of representing numeric values as colors, a.f.a.i.k.

MWE:

\documentclass{standalone}

\usepackage{filecontents}
\usepackage{pgfplots, pgfplotstable}

\begin{filecontents}{data.csv}
yitem,xitem,val
a,X,0.1
a,Z,0.3
b,Y,0.5
b,Z,0.6
c,Y,0.8
\end{filecontents}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
xtick=data,
ytick=data,
unbounded coords=jump,
symbolic x coords={X,Y,Z},
symbolic y coords={a,b,c},
axis line style={draw=none},
tick style=transparent,
y tick label style={
inner sep=0,
font=\tiny,
},
x tick label style={
inner sep=0,
font=\tiny,
rotate=90,
anchor=east,
},
enlarge x limits={abs=1mm},
enlarge y limits={abs=1mm},
x=2mm,
y=2mm,
]
mark=square*,
mark size=1mm,
only marks,
scatter,
mark options={outer sep=0},
scatter/use mapped color={fill=mapped color,draw opacity=0},
point meta=explicit,
] table [
col sep=comma,
x=xitem,
y=yitem,
meta expr=\thisrow{val},
] {\datatable};

\end{axis}
\end{tikzpicture}
\end{document}

-
Take a look at Parametrize shading in table through TikZ, Drawing heatmaps using TikZ, and matlab2tikz imagesc TikZ/pgfplots equivalent for some approaches to similar problems. – Jake Jan 14 '14 at 14:57
Would you consider using a plot? If yes, you can do this with pgfplots. – Marc van Dongen Jan 14 '14 at 17:00
Is this question still current? Or is the list of @Jake's links sufficient? – Christian Feuersänger Jan 15 at 19:08
And I am a little bit confused. It sounds as if you want to have table (sounds a lot like @Jake's links). Or do you want a more systematic way to do this as plot, i.e. like tex.stackexchange.com/a/287006/1537 ? In this case, it might be a duplicate. – Christian Feuersänger Jan 15 at 19:09
Imho, the question "how can I group tick sections with pgfplots" (or should it be "... with pgfplotstable?") should become a separate question as it seems to be beyond the scope of this question. The remaining aspects could be duplicates of the linked questions/answers. – Christian Feuersänger Jan 15 at 19:10