I am trying to construct a plot of a surface in 3d of which the color of the surface is dependent on the z
coordinate. The difficult part is that I need the color to vary 'discretely', not continuously. I believe they call these plots something like iso or level surfaces, if I'm not mistaken.
Examples:
For a color varying continuously with the z
coordinate, the construction in PGFplots
is easy. The \addplot3[surf,shader=faceted interp] ...
works just fine for this.
A minimum working example is
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot3
[
surf,
domain=-1:1,
y domain=-1:1,
samples=50, % DECREASE FOR SHORTER COMPILATION.
shader=faceted interp,
colormap name={hot}
] {exp(-10*(x^2+y^2))};
\end{axis}
\end{tikzpicture}
\end{document}
which results in . How should I modify this LaTeX code to get discrete color variation like in the first two pictures?