Q:

3D plot in Tikz - Points at the top connecting

I've made a plot of the function $z = sqrt(x^2+y^2)$. Here is my output:

At the top of my plot, the points are connecting. How do I stop this from happening? Here is my code:
    \usepackage{pgfplots} 
\begin{document} 
\begin{tikzpicture} 
\begin{axis}[ view={35}{15}, 
axis lines = center, 
width=15cm,height=15cm, 
xtick={-2,-1,0,1,2},ytick={-2,-1,0,1,2},ztick={0,1,2}, 
minor tick={-12,-11,...,12}, 
xmin= - 2.3 ,xmax=2.3,
ymin=-2.3,ymax=2.3,zmin=-0.3,zmax=2.3, ] 
\addplot3[ red, samples=50, domain = -2:2 ] {sqrt(x^2+y^2)}; 
\end{axis} 
\end{tikzpicture} 
\end{document}

A:

You can generate a mesh or surf plot.
\usepackage{pgfplots} 
\begin{document} 
\begin{tikzpicture} 
\begin{axis}[ view={35}{15}, 
axis lines = center, 
width=15cm,height=15cm, 
xtick={-2,-1,0,1,2},ytick={-2,-1,0,1,2},ztick={0,1,2}, 
minor tick={-12,-11,...,12}, 
xmin= - 2.3 ,xmax=2.3,
ymin=-2.3,ymax=2.3,zmin=-0.3,zmax=2.3, ] 
\addplot3[ mesh, red, samples=50, domain = -2:2 ] {sqrt(x^2+y^2)}; 
\end{axis} 
\end{tikzpicture} 
\end{document}

Notice how I added
\addplot3[ mesh, red, samples=50, domain = -2:2 ] {sqrt(x^2+y^2)}; the command mesh at the bracket. You will get this:

Try with surf as well if you want.

