答案1
这是为了给你一个开始。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{3d}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}[declare function={%
f(\x,\y)=(1/(2*pi))*exp(-pow(\x-1,2)/2-pow(\y-1,2)/2);}]
\begin{axis}[zmax=1/pi,zmin=-1/pi,colormap/viridis]
\begin{scope}[canvas is xy plane at z=-1/pi]
\draw[color of colormap=900] (1,1) circle[radius=0.5];
\draw[color of colormap=700] (1,1) circle[radius=1];
\draw[color of colormap=500] (1,1) circle[radius=1.5];
\draw[color of colormap=300] (1,1) circle[radius=2];
\draw[color of colormap=100] (1,1) circle[radius=2.5];
\end{scope}
\addplot3[color=red,thick,samples y=0,domain=-2:4] (x,4,{f(x,1)});
\addplot3[color=blue,thick,samples y=0,domain=-2:4] (-2,x,{f(1,x)});
\addplot3[mesh,domain=-2:4,domain y=-2:4] {f(x,y)};
\addplot3[color=red,thick,samples y=0,domain=4:-2] (x,1,{f(x,1)})
-- (-2,1,{f(1,1)}); ;
\addplot3[color=blue,thick,samples y=0,domain=-2:4] (1,x,{f(1,x)}) --
(1,4,{f(1,1)});
\end{axis}
\end{tikzpicture}
\end{document}
答案2
首先,我非常感谢 Schrondinger cat 帮助我入门。我生成了 pgfplots。
]2