\documentclass[border=2pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} %It is possible to remove this line, but you will get a warning \begin{document} \pgfplotsset{ colormap={whitered}{ color(0cm)=(white); color(1cm)=(orange!75!red) } } \begin{tikzpicture} \begin{axis}[ colormap name=whitered, width=15cm, view={340}{25}, enlargelimits=false, grid=major, domain=-2:2, y domain=-2:2, samples=40, %57 : TeX capacity exceeded, sorry [main memory size=3000000]. % see also http://tex.stackexchange.com/a/7954/5645 xlabel=$x$, ylabel=$y$, zlabel={$z$}, colorbar, colorbar style={ at={(-0.1,0)}, anchor=south west, height=0.25*\pgfkeysvalueof{/pgfplots/parent axis height}, title={$f(x,y)$} } ] \addplot3[surf,draw=black] {x^2-y^2}; \end{axis} \end{tikzpicture} \end{document}