这个图就是下面的代码. 使用 LuaLaTeX 编译, 如果觉得编译太慢, 请事先修改选项 samples
的值.
各个选项的用法可以参考 pgfplots 手册.
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{plotmarks}
\usepackage{tikz-3dplot}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
samples=100,
width=30cm,
xmin=-1,xmax=2,
ymin=-1,ymax=2,
zmin=-2,zmax=2,
contour/number=10
]
\addplot3 [
domain=0:1,
contour lua,
z filter/.code={\def\pgfmathresult{-2}},
]
{sin(deg(2*pi*x))* exp(-10*(y-0.5)^2) + exp(-(x-0.5)^2*10 - (y-0.25)^2 - (x-0.5)*(y-0.25))};
\addplot3 [
domain=0:1,
contour lua={contour dir=x},
x filter/.code={\edef\pgfmathresult{-1}},
]
{sin(deg(2*pi*x))* exp(-10*(y-0.5)^2) + exp(-(x-0.5)^2*10 - (y-0.25)^2 - (x-0.5)*(y-0.25))};
\addplot3 [
domain=0:1,
contour lua={contour dir=y},
y filter/.code={\edef\pgfmathresult{2}},
]
{sin(deg(2*pi*x))* exp(-10*(y-0.5)^2) + exp(-(x-0.5)^2*10 - (y-0.25)^2 - (x-0.5)*(y-0.25))};
\addplot3 [
surf,
mesh/interior colormap={blueblack}{color=(black) color=(white)},
colormap/blackwhite, samples=30,
domain=0:1,
]
{sin(deg(2*pi*x))* exp(-10*(y-0.5)^2) + exp(-(x-0.5)^2*10 - (y-0.25)^2 - (x-0.5)*(y-0.25))};
\end{axis}
\end{tikzpicture}
\end{document}
问 如何使用pgfplots 宏包对空间曲面呈现多图像?