三维图中的多个二维高斯椭圆

三维图中的多个二维高斯椭圆

我想在 3D 空间的不同点处绘制不同的二元高斯分布作为阴影二维椭圆。我会按照 Jake 的建议绘制二维椭圆使用 tikz 的高斯椭圆体,但从技术上讲,这已经是一个 3D 图了。 是否有可能扩展此方法?


我想出了以下示例(左:我喜欢椭圆的方向示例,取自https://arxiv.org/abs/1611.03986,对:我的假设):

在此处输入图片描述上述 .tex 文件的输出

两个要点是

  • 颜色图实际上并不透明,并且不再能看到外部坐标系的轴,
  • 我希望将省略号放在一个固定点在里面西泽-平面(这意味着黑色矩形的底线应该与X-轴并相应压缩)。
\documentclass{standalone}
\usepackage{tikz,pgfplots}
\usepgfplotslibrary{patchplots}
\pgfplotsset{%
    colormap={whitered}{color(0cm)=(transparent); color(1.cm)=(red)}%
}
\begin{document}
\begin{tikzpicture}[baseline,
    declare function={bivar(\ma,\sa,\mb,\sb)=
        1/(2*pi*\sa*\sb) * exp(-((x-\ma)^2/\sa^2 + (y-\mb)^2/\sb^2))/2;}]
% Outer coordinate system
\begin{axis}[
    unit vector ratio*=1 1 1,
    axis lines = middle,
    view={120}{30},
    domain = -10:10,
    zmin = -5, zmax = 5,
    xlabel = $x$, ylabel = $y$, zlabel = $z$,
    x label style={at={(ticklabel* cs:1.)},anchor=north east},
    y label style={at={(ticklabel* cs:1.)},anchor=north west},
    z label style={at={(ticklabel* cs:1.)},anchor=south},
    ]
    \coordinate (origin1) at (axis cs:0,-10,0);
    \coordinate (origin2) at (axis cs:0,10,0);
    \addplot3[no markers,opacity=0]{0}; % <- without this pseudo plot, the outer coordinate system does not work
\end{axis}
% Bivariate distribution 1
\begin{axis}[
    at={(origin1)}, anchor={center},
    width=3cm, height=3cm,
    scale only axis,
    axis equal image,
    hide axis,
    colormap name=whitered,
    view={0}{90},
    enlargelimits=false,
    domain=-1.5:1.5, y domain=-1.5:1.5,
    ]
    \addplot3 [surf, draw=none, samples=19, shader=interp, patch type=bilinear] {bivar(0,.1,0,.6)};
\end{axis}
% Bivariate distribution 2
\begin{axis}[
    at={(origin2)}, anchor={center},
    width=3cm, height=3cm,
    scale only axis,
    axis equal image,
    hide axis,
    colormap name=whitered,
    view={0}{90},
    enlargelimits=false,
    domain=-1.5:1.5, y domain=-1.5:1.5,
    ]
    \addplot3 [surf, draw=none, samples=19, shader=interp, patch type=bilinear] {bivar(0,.2,0,.3)};
\end{axis}
\end{tikzpicture}
\end{document}

相关内容