I just created this heatmap, following this template: https://tikz.net/heatmap/
Now I would like to customize a few things:
- If I replace the Column Label with $j=1$ bsp. then the labels overlap. How can I make the boxes in the square larger so that the text fits well on it?
- Unfortunately, because of the smaller colors, the heat gradations are different. How do I adjust this to my values, so that three is the maximum?
Here is my code:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[scale=0.6]
\foreach \y [count=\n] in {
{0,1,2,0,0,1,2,1,3,2,1,2,1,1},
{0,1,0,0,1,1,1,1,0,0,0,0,1,0},
{3,1,1,3,2,1,0,1,0,1,2,1,1,2},
} {
% heatmap tiles
\foreach \x [count=\m] in \y {
\node[fill=purple!\x!yellow, minimum size=6mm, text=white] at (\m,-\n) {\x};
}
}
% row labels
\foreach \a [count=\i] in {$k=1~~~$,$k=2~$,$k=3~~~$} {
\node[minimum size=6mm] at (0,-\i) {\a};
}
\foreach \b [count=\j] in {1,2,3,4,5,6,7,8,9,10,11,12,13,14} {
\node[minimum size=6mm] at (\j,0) {\b};
}
\end{tikzpicture}
\end{document}

\xgoes) from 0 to 100, so you will need to multiply\xby 100/3 to get the whole spectrum from purple to yellow. The row labels are better set withleftinstead of a bunch of~s. For the column headers you will need to make a decision. Should the heatmap tiles just scretch in the horizontal direction or should the remain square? You will have to changeminimum widthorminimum sizerespectively. – Qrrbrbirlbel Jul 21 '23 at 13:18\xdo i need to multiply? Would\x*(100/3)work? – marvelfab12 Jul 21 '23 at 13:26