]> code.communitydata.science - ml_measurement_error_public.git/blob - charts/example_2_dag/example_2_dag.tex
update plotting code and makefile
[ml_measurement_error_public.git] / charts / example_2_dag / example_2_dag.tex
1 \documentclass[12pt]{standalone}
2
3 \usepackage{ucs}
4 \usepackage[utf8x]{inputenc}
5
6 \usepackage[T1]{fontenc}
7 \usepackage{textcomp}
8 \renewcommand{\rmdefault}{ugm}
9 \renewcommand{\sfdefault}{phv}
10 \usepackage[garamond]{mathdesign}
11 \usepackage{tikz}
12 \usetikzlibrary{positioning, shapes, arrows, shadows}
13
14 \begin{document}
15
16 \tikzset{>=latex}
17 \begin{tikzpicture}[
18   observed/.style={circle, draw},
19   partly observed/.style 2 args={draw, fill=#2, path picture={
20       \fill[#1, sharp corners] (path picture bounding box.south west) -|
21       (path picture bounding box.north east) -- cycle;},
22      circle},
23     unobserved/.style={draw, circle, fill=gray!40}
24   ]
25
26   \node[observed] (y) {Y};
27   \node[observed,above=of y, xshift=1cm] (r) {R};
28   \node[partly observed={white}{gray!40}, left=of r] (x) {X};
29   \node[observed, left=of x] (w) {W};
30   \node[unobserved, above=of w, xshift=1cm] (k) {K};
31   
32   \matrix [draw, below, yshift=-0.2cm, font=\small, align=center, column sep=2\pgflinewidth, inner sep=0.6em, outer sep=0em, nodes={align=center, anchor=center}] at (current bounding box.south){
33     \node[observed,label=right:observed] {}; \\
34     \node[unobserved,label=right:unobserved]{}; \\
35   };
36
37
38   \draw[->] (r) -- (y);
39   \draw[->] (r) -- (x);
40   \draw[->] (x) -- (y);
41   \draw[->] (x) -- (w);
42   \draw[->] (k) -- (x);
43   \draw[->] (k) -- (w);
44
45 \end{tikzpicture}
46 \end{document}
47

Community Data Science Collective || Want to submit a patch?