So let me first of all shamelessly steal heatmap code from this answer to Drawing heatmaps using TikZ
\documentclass{standalone}
\usepackage{colortbl}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotstableset{
/color cells/min/.initial=0,
/color cells/max/.initial=1000,
/color cells/textcolor/.initial=,
%
% Usage: 'color cells={min=<value which is mapped to lowest color>,
% max = <value which is mapped to largest>}
color cells/.code={%
\pgfqkeys{/color cells}{#1}%
\pgfkeysalso{%
postproc cell content/.code={%
%
\begingroup
%
% acquire the value before any number printer changed
% it:
\pgfkeysgetvalue{/pgfplots/table/@preprocessed cell content}\value
\pgfmathfloatparsenumber{\value}%
\pgfmathfloattofixed{\pgfmathresult}%
\let\value=\pgfmathresult
%
% map that value:
\pgfplotscolormapaccess
[\pgfkeysvalueof{/color cells/min}:\pgfkeysvalueof{/color cells/max}]
{\value}
{\pgfkeysvalueof{/pgfplots/colormap name}}
% now, \pgfmathresult contains {<R>,<G>,<B>}
%
% acquire the value AFTER any preprocessor or
% typesetter (like number printer) worked on it:
\pgfkeysgetvalue{/pgfplots/table/@cell content}\typesetvalue
\pgfkeysgetvalue{/color cells/textcolor}\textcolorvalue
%
% tex-expansion control
% see https://tex.stackexchange.com/questions/12668/where-do-i-start-latex-programming/27589#27589
\toks0=\expandafter{\typesetvalue}%
\xdef\temp{%
\noexpand\pgfkeysalso{%
@cell content={%
\noexpand\cellcolor[rgb]{\pgfmathresult}%
\noexpand\definecolor{mapped color}{rgb}{\pgfmathresult}%
\ifx\textcolorvalue\empty
\else
\noexpand\color{\textcolorvalue}%
\fi
\the\toks0 %
}%
}%
}%
\endgroup
\temp
}%
}%
}
}
\begin{document}
\pgfplotstabletypeset[
color cells={min=-1,max=1,textcolor=black},
/pgfplots/colormap={orangewhiteorange}{rgb255=(255,170,0) color=(white) rgb255=(255,170,0)},
/pgf/number format/fixed,
/pgf/number format/precision=3,
col sep=comma,
columns/Correlations/.style={reset styles,string type}
]{
Correlations,a,b,c,d
a,1,,,
b,0.448,1,,
c,-0.295,-0.136,1,
d,-0.350,-0.154,0.313,1
}
\end{document}
This would work just fine, if only there weren't those empty cells which produce nasty errors because they can't be parsed as a floating point number.
I tried to blindly fiddle around with stuff like \ifx\value\empty\let\value=0\fi but I only managed to produce different errors.
What this is supposed to look is this table (just more regular and with better alignment):


\begingroup\nullfontremoves most of it (which is another clue that there is a spurious space somewhere in the code). Also it's the first object so\noindentalso removes some of it. However it's still not completely removed. – percusse Feb 02 '13 at 02:30columns/a/.style={minimum width = 10em, column type={S[table-format=-1.3]}}to work :/ Any quick ideas? Otherwise I can really make this into a new question. – Christian Feb 02 '13 at 11:59minimum widthis used for TikZ nodes only. And your approach does not use TikZ at all - it is just a plain tabular environment. Perhaps a column type ofp{10em}would be what you need? – Christian Feuersänger Feb 02 '13 at 19:42