Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created September 5, 2024 06:39
Show Gist options
  • Save abikoushi/d99133dfa6243469114ffe6dd1323ba5 to your computer and use it in GitHub Desktop.
Save abikoushi/d99133dfa6243469114ffe6dd1323ba5 to your computer and use it in GitHub Desktop.
Tikz example: relationship between binomial and geometric distribution
\documentclass{beamer}
\usepackage{tikz}
\setbeamertemplate{navigation symbols}{}
\usetikzlibrary{positioning}
\makeatletter
\usefonttheme{serif}
\usepackage{xcolor}
\def\mathunderline#1#2{\color{#1}\underline{{\color{black}#2}}\color{black}}
\begin{document}
\begin{frame}{Geometric distribution}
\begin{figure}
\centering
$$
\mbox{Bernoulli trials: }
\mathunderline{magenta}{0,} 1, \mathunderline{magenta}{0, 0,} 1, \mathunderline{magenta}{0,} 1\mathunderline{magenta}{,} 1
$$
\begin{tikzpicture}
\node[] at(0,0)(Bernoulli){Bernoulli};
\node[below = of Bernoulli](binomial){binomial};
\path[draw,->, thick, color = cyan] (Bernoulli) -> (binomial) node[midway, left, align=center]{multiple\\trials};
\node[right = of Bernoulli](geom){geomtric};
\node[right = of binomial, align=left](negbin){negative\\binomial};
\path[draw,->, thick, color = cyan] (geom) -> (negbin);
\path[draw,->, thick, color = magenta] (Bernoulli) -> (geom) node[midway, above, align=center, yshift = 5pt]{waiting time};
\path[draw,->, thick, color = magenta] (binomial) -> (negbin);
\end{tikzpicture}
%\caption{}
\end{figure}
\end{frame}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment