# How to draw a z-simple paraboloid in a “clean” way

I'd like to draw z=x^2+y^2 on the interval 0<z<9. So normally I've just been using pgfplots with the addplot3 command, and for rectangular domains that doesn't seem to cause too much trouble. Example (from Is there any easy way to draw a ruled surface like a hyperbolic paraboloid in TikZ?):

In my case, however, I'd like to draw a paraboloid and I'd like the edge of the curve to be at r=3 in the z=9 plane. My first attempt was something like this (adapted from previous question):

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=-3,ymin=-3,zmin=0,xmax=3,ymax=3,zmax=10]
\addplot3 [surf,draw=none,restrict z to domain=0:9] {x^2+y^2};
\end{axis}
\end{tikzpicture}
\end{document}


Clearly the domain causes a problem: the paraboloid doesn't print pretty at all because the last z value evaluated is not at z=9, it is rather somewhere close to that below z=9, varying for each pair of coordinates (x,y).

I could set samples y=300, but the compilation time will be insane. Also, it limits the possibilities of the document, since I'm consuming a lot of stack size.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=-3,ymin=-3,zmin=0,xmax=3,ymax=3,zmax=10]
\addplot3 [surf,draw=none,restrict z to domain=0:9,samples y=300] {x^2+y^2};
\end{axis}
\end{tikzpicture}
\end{document}


Surely there's a better way to do this?

• You have to switch to polar description of the surface to make the level sets parallel to the xy plane. Then you can cut the surface in a sane fashion. Pgfplots don't know how to chop off the mesh in the middle to limit the visible region. – percusse Apr 21 '15 at 9:31

\documentclass{article}