I have a matrix plot with nan meta values. Now I want to print only the nodes near coords which are not nan but somehow I cannot figure out how to do that.
Here is a MWE:
\documentclass[tikz, border=1cm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{ifthen}
\pgfplotsset{width=7cm,compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false,
point meta rel=per plot,
nodes near coords={%
\ifthenelse{\expandafter\equal{\pgfmathprintnumber\pgfplotspointmeta}{NaN}}{}{\pgfmathprintnumber\pgfplotspointmeta}}]
\addplot [matrix plot,
point meta=explicit,
] coordinates {
(0,0) [0] (1,0) [1] (2,0) [2]
(0,1) [nan] (1,1) [nan] (2,1) [nan]
};
\end{axis}
\end{tikzpicture}
\end{document}
Thanks for any help!
