I generated a checkerboard style suface plot using matlab2tikz. The data contains nan (not a number) values. I want the squares of nan values to be white (as in matlab). When I compile, I get the following warning:
Package pgfplots Warning: The per point meta data `nan' (3Y0.0e0]) (and probabl y others as well) is unbounded - using the minimum value instead. on input line 58.
and the square is filled with the colour for '0'. I tried to skip the nan values using
unbounded coords=discard
The warning and the behaviour stayed the same. When removing the nan values, the square seems to take the color of its neighbour.
Here's the code generated by matlab2tikz:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
view={0}{90},
scale only axis,
xmin=1, xmax=5,ymin=1,ymax=5,zmin=-1,zmax=1,
hide axis,
colormap/jet,
colorbar,
point meta min=1,
point meta max=100
]
\addplot3[%
surf,
shader=flat corner,
draw=black,
colormap/jet,
point meta=explicit,
%unbounded coords=discard,
mesh/rows=5]
table[row sep=crcr,header=false,meta index=3] {
1 1 0 1 \\
1 2 0 10 \\
1 3 0 20 \\
1 4 0 30 \\
1 5 0 1 \\
2 1 0 40 \\
2 2 0 nan \\
2 3 0 50 \\
2 4 0 60 \\
2 5 0 1 \\
3 1 0 70 \\
3 2 0 80 \\
3 3 0 90 \\
3 4 0 nan \\
3 5 0 1 \\
4 1 0 75 \\
4 2 0 80 \\
4 3 0 85 \\
4 4 0 100 \\
4 5 0 1 \\
5 1 0 1 \\
5 2 0 1 \\
5 3 0 1 \\
5 4 0 1 \\
5 5 0 1 \\
};
\end{axis}
\end{tikzpicture}
\end{document}
And here the output:

Is there a way to not drawing the squares with nan values? Or to add a discrete color to the continuous colormap so that nan values are drawn in white?

compat=1.10and putcompat=1.9– Mar 08 '14 at 00:03compat=1.9– vipers36 Mar 08 '14 at 13:09