0

I would like to colour individual cells of a table based on quantity. For example if the cell value is <5 then the colour should be green. if >5 but less than 10 should be orange, and red for if the cell is 10. Any ideas? The only solutions I have found colour the entire column/row. Thanks for the help, My following code for the table is:

\begin{table}[ht]
    \centering
    \setcellgapes{3pt}
    \makegapedcells
\begin{tabularx}{\linewidth}{|*{8}{C|} }
    \hline
\makecell{Mean\\ Partnership\\ Duration}
    & \multicolumn{7}{c|}{The number of simulations resulting in an epidemic out of 10 for mean degree}\\
\cline{2-8}
    & 0.2 &0.4& 0.6 & 0.8 & 1.0 & 1.2 & 1.4\\
\hline
100   & 0 & 0 & 0 &  3 & 8 & 10 & 10\\
\hline
80   & 0 & 0 & 1  & 3 & 9 & 10& 10\\
\hline
60   & 0 & 0 & 2 & 8 & 9 & 10& 10\\
\hline
40   & 0 & 2 & 5 & 8 & 10 & 10& 10\\
\hline
20   & 0& 8  &  9 & 9 & 10 & 10& 10\\
\hline
10 & 0 & 8 &  9 & 10 & 10 & 10& 10\\
\hline
\end{tabularx}
\caption{The number of simulations that resulted in an epidemic for a certain mean partnership duration and mean degree}
\label{My table}
    \end{table}

0 Answers0