The following MWE is taken from here.
I have a correlation matrix, and for simplicity, I would like to leave the upper triangle empty. However, the code breaks when I do that (probably because of the if phrase).
How do I need to adjust the code to allow for empty cells?
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{pgfplotstable}
\pgfplotstableset{
color cells/.style={
col sep=comma,
string type,
postproc cell content/.code={%
\pgfkeysalso{@cell content=\rule{0cm}{2.4ex}%
\pgfmathtruncatemacro\number{##1}%
\ifnum\number<0
\cellcolor{red!-##1}##1
\else
\cellcolor{green!##1}##1
\fi
}},
columns/x/.style={
column name={},
postproc cell content/.code={}
}
}
}
\begin{document}
\begin{table}\caption{Correlation or something}
\centering
\pgfplotstabletypeset[color cells]{
x,a,b,c,d
a,90,-10.5,0,0
b,0,80,10,-10
c,0,0,-95,5
d,0,10,5,-85
}
\end{table}
\end{document}

