I know how to tranch a 3D graph by x, by y. ![TAQuestionHackByXY.png](/image?hash=5383b22b5822f2728f9a274d75354b3bf2fdabc1ee00755ca5e2a4ec9b821eba) https://tex.stackexchange.com/questions/541934/hack-the-plot-handler-to-display-every-x-line-on-a-3d-plot z is missing... but Based on [this](https://tex.stackexchange.com/questions/526611/animation-a-plan-cutting-a-surface) pretty solution (I recognized you user194703 :p) : ![TAQuestionHackByZ.png](/image?hash=48c0666bdc6ce0252ca0605878d7c68be44855f43faeddcabbb2864b6c044c10) However, I struggle switching to standard coordinates for my favorite `exp(-x^2-y^2)` function. Original code ``` \documentclass[tikz,border=10pt]{standalone} \usepackage{pgfplots} \pgfplotsset{width=7cm,compat=1.16} \begin{document} \foreach \X [count=\Y] in {-4.5,-4,...,4.5} { \begin{tikzpicture} \begin{axis}[ grid=major,view={20}{40},z buffer=sort, data cs=polar] %3D plot below plane \addplot3 [surf, domain=0:360, domain y=5-\X:10,samples=30, samples y=1+\Y]{-y+5}; %Plane \addplot3 [data cs=cart,surf,domain=-10:10,samples=2, opacity=0.5,point meta=0]{\X}; %Plot on plane \addplot3 [domain=0:360, samples y=0, samples=30, thick, z buffer=auto](x,5.1-\X,\X); %3D plot above plane \addplot3 [surf,domain=0:360, domain y=0:5-\X,samples=30, samples y=21-\Y]{-y+5}; \end{axis} \end{tikzpicture} } \end{document} %\addplot3 [surf, domain=-3:3, domain y=-3:3,samples=30, samples y=20]{exp(-x^2-y^2)}; %\addplot3 [surf,domain=-3:3,samples=2, opacity=0.3]{0.5}; I try to tranche based on z= 0.5. ```

Something like this? The height of the plane is called `\X`. Then we need to invert `exp(-y^2)=\X`, the result of this exercise is called `\Z`, `\Z=sqrt(-ln(\X))`, where of course `0<\X<1`. ``` \documentclass[tikz,border=10pt]{standalone} \usepackage{pgfplots} \pgfplotsset{width=7cm,compat=1.16} \begin{document} \foreach \X [count=\Y] in {0.05,0.1,...,0.95} { \begin{tikzpicture} \begin{axis}[ grid=major,view={20}{40},z buffer=sort, data cs=polar] \pgfmathsetmacro{\Z}{sqrt(-ln(\X))} %3D plot below plane \addplot3 [surf, domain=0:360, domain y=\Z:2,samples=30, samples y=1+\Y]{exp(-y*y)}; %Plane \addplot3 [data cs=cart,surf,domain=-2:2,samples=2, opacity=0.5,point meta=0]{\X}; %Plot on plane \addplot3 [domain=0:360, samples y=0, samples=30, thick, z buffer=auto](x,\Z,\X); %3D plot above plane \addplot3 [surf,domain=0:360, domain y=0:\Z,samples=30, samples y=21-\Y]{exp(-y*y)}; \end{axis} \end{tikzpicture} } \end{document} ``` ![ani.gif](/image?hash=6e6773842dcf15e67040d5863a9fc19e9ae4d50631a68c6299b4f7215c79a1df) This example exploits that function is spherically symmetric, and the function value only depends on the radial coordinate. In more general situations one can work with clips. They are less general but in simple enough examples they can be made work. In this context one may employ the view parameters so that the example also works for rotated views. (In the following example there are still hard-coded values like `2` instead `xmax` but this is just to illustrate the idea.) ``` \documentclass[tikz,border=10pt]{standalone} \usepackage{pgfplots} \pgfplotsset{width=7cm,compat=1.16} \begin{document} \foreach \X [count=\Y] in {0.05,0.1,...,0.95} { \begin{tikzpicture} \begin{axis}[ grid=major,view={20}{40},z buffer=sort] \pgfmathsetmacro{\Z}{sqrt(-ln(\X))} %3D plot below plane \addplot3 [surf, domain=-2:2,samples=21]{exp(-y*y-x*x)}; %Plane \addplot3 [surf,domain=-2:2,samples=2, opacity=0.5,point meta=0]{\X}; \clip ({3*cos(\pgfkeysvalueof{/pgfplots/view/az})}, {3*sin(\pgfkeysvalueof{/pgfplots/view/az})},\X) -- ({\Z*cos(\pgfkeysvalueof{/pgfplots/view/az})}, {\Z*sin(\pgfkeysvalueof{/pgfplots/view/az})},\X) arc[start angle=\pgfkeysvalueof{/pgfplots/view/az}, end angle=\pgfkeysvalueof{/pgfplots/view/az}-180,radius=\Z] -- ({-3*cos(\pgfkeysvalueof{/pgfplots/view/az})}, {-3*sin(\pgfkeysvalueof{/pgfplots/view/az})},\X) -- (-2,-2,1) -- (-2,2,1) -- (2,2,1) -- cycle; % %3D plot above plane \addplot3 [surf, domain=-2:2,samples=21]{exp(-y*y-x*x)}; \end{axis} \end{tikzpicture} } \end{document} ``` ![ani.gif](/image?hash=052441338941b0c30ff25e8c9c82975e39ffdd97cd483b9efd2dd9fa9d6ff917)