I have seen the following code in response to another similar question that works when the numbers in the table are between 0 and 100. How do I have to modify this code so that it works for numbers between 0 and 1 (or any arbitrary range?). My idea is that I need to modify the line:
\cellcolor{black!##1}
so that it somehow multiples this by 100, but I can't figure out how to do this.
Here is the full code that works for the numbers given (between 0 and 100) - I would like to do the same for number between 0 and 1. Thanks
\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}\cellcolor{black!##1}\pgfmathtruncatemacro\number{##1}\ifnum\number>50\color{white}\fi##1}%
},
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}

\documentclass{...}and ending with\end{document}. – Jun 12 '14 at 20:08