TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:
plot as a table

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.



\usepackage{pgfplots, pgfplotstable}


\pgfplotstableread[col sep=comma]{data.csv}\datatable


    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,
    x tick label style={
        inner sep=0,
    enlarge x limits={abs=1mm},
    enlarge y limits={abs=1mm},
    mark size=1mm,
    only marks,
    mark options={outer sep=0},
    scatter/use mapped color={fill=mapped color,draw opacity=0},
    point meta=explicit,
] table [
    col sep=comma,
    meta expr=\thisrow{val},
] {\datatable};

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

Your Answer


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

Browse other questions tagged or ask your own question.