[Tex/LaTex] Controlling visibility of 3D axes in \addplot3

3dpgfplots

In trying to use \addplot3 to draw a paraboloid, the domain of which is [-4, 4] for both x and y, originally, the z-axis was sitting behind the surface. I discovered axis on top, but can you get the axes to show how they would in "reality". That is, in front where they're actually in front and behind where they're actually behind.

I normally do include an MWE, the only reason I didn't at first is because I thought it was just to do with some simple settings and those with experience would know what to do right away. The following code only includes one run of the picture. The output shows two runs of the picture, the one on the left with the code below as is, the one on the right deleting the % from % axis on top.

You either get the axes obscured entirely, or they're entirely in front. I only want in front what's actually in front.

MWE

Output

\documentclass{standalone}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pgfplots}
\usepackage{mathtools}

\begin{document}
%
\par\begin{tikzpicture}
%
\begin{axis}[
    axis lines=middle, axis on top,
    xtick={-2,2}, ytick={-2,2},ztick={16,32},
    y dir=reverse,
    enlargelimits=true
    ]
\addplot3[surf, thick, color=green, domain=-4:4] {x^2+y^2};
%
\end{axis}
%
\end{tikzpicture}
%
\end{document}

Best Answer

Doing this automatically is currently beyond the capabilities of pgfplots, sorry.

Implementing it would be quite cool, but highly complex as well - it involves full 3d depth handling (see the discussion in the pgfplots manual at the beginning of 3d plots for a full description of the current limitations).

Pgfplots is generally better off with non-centered axis lines in which this problem does not appear - if that is an option for you.