在 pgfplot 中将二维图形组合起来形成曲面的命令?

在 pgfplot 中将二维图形组合起来形成曲面的命令?

我有 2 个图表,我想显示这两个图表之间的积分,因为 z 平面上有分离。基本上,是否有命令可以在两个 2D 图表之间绘制一个表面?这就是我要做的,但只寻找绿色区域。

Here is what I'm going for but only looking for the green area.

答案1

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16,width=10cm,height=7cm}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}[declare function={%
f(\x)=0.4*sin(180*\x)+1.8+0.2*\x;
g(\x)=(\x-2)^2-1;}]
\begin{axis}[axis lines=middle,axis on top,smooth,
xtick=\empty,ytick=\empty,domain=0.3:3.4,enlargelimits=0.1]
\addplot[blue,thick,name path=f] {f(x)} node[pos=0.2,above=6pt]{$y=f(x)$};
\addplot[red,thick,name path=g] {g(x)} node[pos=0.3,below=14pt]{$y=g(x)$};
\addplot [green!50!gray] fill between [of=f and g];
\path (0.3,{f(0.3)}) coordinate (a') (3.4,{f(3.4)}) coordinate (b')
 (0,0) coordinate (O);
\end{axis}
\foreach \X in {a,b}
{\draw[dashed] (\X') -- (O-|\X') node[below]{$\X'$};}
\end{tikzpicture}
\end{document}

enter image description here

相关内容