Created
October 6, 2014 14:55
-
-
Save lcomm/e31e7d4c79918c60cc4d to your computer and use it in GitHub Desktop.
TikZ-based LaTeX code to create 3 basic DAGs in epidemiology/biostatistics.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[]{article} | |
\usepackage{tikz} | |
\usetikzlibrary{positioning} | |
\begin{document} | |
%Graph 1 | |
\begin{figure} | |
\caption{Graph 1} | |
\large{\begin{tikzpicture}[% | |
->, | |
>=stealth, | |
node distance=1cm, | |
pil/.style={ | |
->, | |
thick, | |
shorten =2pt,} | |
] | |
\node (1) {Y}; | |
\node[left=of 1] (2) {A}; | |
\node[right=of 1] (3) {L}; | |
\draw [->] (1.east) -- (3.west); | |
\draw [->] (2) to [out=30, in=150] (3); | |
\end{tikzpicture}} | |
\end{figure} | |
%Graph 2 | |
\begin{figure} | |
\caption{Graph 2} | |
\large{\begin{tikzpicture}[% | |
->, | |
>=stealth, | |
node distance=1cm, | |
pil/.style={ | |
->, | |
thick, | |
shorten =2pt,} | |
] | |
\node (1) {L}; | |
\node[left=of 1] (2) {A}; | |
\node[below left=of 2] (3) {U}; | |
\node[right=of 1] (4) {Y}; | |
\draw [->] (2) to (1); | |
\draw [->] (3) to (1); | |
\draw [->] (3) to (4); | |
\end{tikzpicture}} | |
\end{figure} | |
%Graph 3 | |
\begin{figure} | |
\caption{Graph 3} | |
\large{\begin{tikzpicture}[% | |
->, | |
>=stealth, | |
node distance=1cm, | |
pil/.style={ | |
->, | |
thick, | |
shorten =2pt,} | |
] | |
\node (1) {Y}; | |
\node[left=of 1] (2) {A}; | |
\node[right=of 1] (3) {L}; | |
\node[rectangle, draw, right=of 3] (4) {C}; | |
\draw [->] (1) to (3); | |
\draw [->] (3) to (4); | |
\draw [->] (2) to [out=30, in=150] (3); | |
\end{tikzpicture}} | |
\end{figure} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
totally used this for a hand in. Thanks :)