I found a very nice answer here, that solves turning text white or black in a matrix plot depending on the value.
I wish to apply this to a groupplot, but the value at which the color should change needs to be different for the two parts of the groupplot since they are on a different scale.
My problem is twofold: a) I couldn't for the life of me get this working by copying it into my groupplots, and b) the piece of code is HUGE, while I would really only like to see a setting within the \nextgrouplot alongside the current point meta min setting with something like change colour = 0.3.
So how would you adapt this to a groupplot so the level of change can be set and most of the code is only typed once.
mwe for making a side-by-side matrix plot with different scales.
% !TeX program = lualatex
\documentclass[border=5mm,tikz]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colormaps}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.15}
\usepackage{fontspec}
\pgfplotsset{style matrix/.style= {matrix plot, nodes near coords, nodes near coords align=center, opacity=0.8,font=\bfseries\large}}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[group style={group size=2 by 1, horizontal sep=2cm,
xlabels at=edge bottom
},
colormap name=viridis,
typeset ticklabels with strut,
nodes near coords style={
/pgf/number format/fixed,
},
]
\nextgroupplot[
view={0}{90},
colorbar,
xtick=data,
ytick=data,
xticklabels={,,,},
yticklabels={,,,},
point meta min=0.4,
point meta max=0.7,
]
\addplot3[style matrix] table [meta=z]{
x y z
0 0 0.507006787825706
1 0 0.419818693341669
2 0 0.41
3 0 0.513713862120089
0 1 0.474709875191592
1 1 0.604668125455872
2 1 0.581785714285714
3 1 0.618143068939956
0 2 0.434311364134005
1 2 0.580077107429405
2 2 0.539107142857143
3 2 0.514269829503336
0 3 0.471863367637399
1 3 0.562259039283109
2 3 0.564821428571429
3 3 0.577372127501853
};
\nextgroupplot[
view={0}{90},
colorbar,
xtick=data,
ytick=data,
yticklabels={,,,},
xticklabels={,,,},
yticklabel style={rotate=90},
point meta min=0.0,
point meta max=1.0,
]
\addplot3[style matrix] table[meta=z] {
x y z
0 0 0.883183709218305
1 0 0.695008856934459
2 0 0.797767857142857
3 0 0.784006671608599
0 1 0.718086271075104
1 1 0.80150046889653
2 1 0.745178571428571
3 1 0.743606375092661
0 2 0.955386468141012
1 2 0.890486610399083
2 2 0.876339285714286
3 2 0.842105263157895
0 3 0.718086271075104
1 3 0.701573408356778
2 3 0.745178571428571
3 3 0.827001482579689
};
\end{groupplot}
\end{tikzpicture}
\end{document}

change colorkey in the way you describe, I have no clue whatsoever with regards to the\inputpart; I do not even understand the question. – Feb 11 '20 at 23:54change colorkey and make a separate question about outsourcing. – fbence Feb 12 '20 at 00:05