tikz 中节点下方的花括号(bayesnet)

tikz 中节点下方的花括号(bayesnet)

我希望在几个节点下面有一个花括号,如图所示。我试着遵循这个例子,但我无法理解。

谢谢

\documentclass[11pt]{report}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{bayesnet}
\begin{document}

\begin{figure}
    \centering
    \tikz{ %
        \node[latent]                       (phi)   {$\phi$};
        \node[latent,   above = of phi]     (y)     {$y$};
        \node[obs,      left = of y]        (Obs_y) {$ \tilde {\bf{y}}$};
        \node[latent,   below = of Obs_y]   (sigma) {$\sigma_y$};
        \edge {phi} {y};
        \edge {y, sigma} {Obs_y};
}
\end{figure}
\end{document}

在此处输入图片描述

答案1

这是实现此目的的一种方法。

示例输出

\documentclass[11pt]{report}
\usepackage{tikz}
\usetikzlibrary{positioning,decorations.pathreplacing,calc}
\usetikzlibrary{bayesnet}
\begin{document}

\begin{figure}
    \centering
    \tikz{ %
        \node[latent]                       (phi)   {$\phi$};
        \node[latent,   above = of phi]     (y)     {$y$};
        \node[obs,      left = of y]        (Obs_y) {$ \tilde {\bf{y}}$};
        \node[latent,   below = of Obs_y]   (sigma) {$\sigma_y$};
        \edge {phi} {y};
        \edge {y, sigma} {Obs_y};
        \draw[decorate,decoration={brace}] ($(sigma)+(0.5,-0.5)$) --
        node[below]{$x$} ++(-1,0) ; 
}
\end{figure}
\end{document}

对于下面的底部的支撑sigma_yphi你可以使用

\documentclass[11pt]{report}
\usepackage{tikz}
\usetikzlibrary{positioning,decorations.pathreplacing,quotes}
\usetikzlibrary{bayesnet}
\begin{document}

\begin{figure}
    \centering
    \tikz{ %
        \node[latent]                       (phi)   {$\phi$};
        \node[latent,   above = of phi]     (y)     {$y$};
        \node[obs,      left = of y]        (Obs_y) {$ \tilde {\bf{y}}$};
        \node[latent,   below = of Obs_y]   (sigma) {$\sigma_y$};
        \edge {phi} {y};
        \edge {y, sigma} {Obs_y};
        \path (sigma.south west)
        edge[decorate,decoration={brace,mirror,raise=.15cm},"$x$"below=6pt]
        (sigma.south west -| phi.south east);
}
\end{figure}
\end{document}

第二个示例

相关内容