Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created September 12, 2025 14:53
Show Gist options
  • Select an option

  • Save abikoushi/44d3bdc8ae5bb96cb220c41507a0cf5e to your computer and use it in GitHub Desktop.

Select an option

Save abikoushi/44d3bdc8ae5bb96cb220c41507a0cf5e to your computer and use it in GitHub Desktop.
TikZ bayesnet example
\documentclass[tikz, border=14pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{bayesnet}
\begin{document}
\begin{tikzpicture}
\node[obs] (x) {$X$};
\node[obs, above right = of x] (z) {$Z$};
\node[obs, below right = of z] (y) {$Y$};
\edge{x}{y};
\edge{z}{y};
\edge{z}{x};
\plate {plate1} {(x)(y)(z)} {$i=1,\ldots, n$ };
\node[latent, right = of y] (x2) {$X^\ast$};
\node[latent, above right = of x2] (z2) {$Z^\ast$};
\node[latent, below right = of z2] (y2) {$Y^\ast$};
\edge{x2}{y2};
\edge{z2}{y2};
\node[latent, left = of x] (phi) {$\phi$};
\node[latent, above right = of z] (gamma) {$\gamma$};
\node[latent, below right = of y] (psi) {$\Psi$};
\edge{psi}{y,y2};
\edge{gamma}{z, z2};
\edge{phi}{x};
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment