I'm trying to create a Horizontal Probability Tree with Level Labels using tikz. (Not tikz-qtree). Right now, I have a horizontal tree. The labels are NOT aligned to the top of the diagram. I would like to have all the labels aligned without having to manually tweak positions.
Here is the MWE:
\tikzstyle{level 1}=[level distance=3.5cm, sibling distance=3.5cm]
\tikzstyle{level 2}=[level distance=4.5cm, sibling distance=1.5cm]
\tikzstyle{level 3}=[level distance=3.5cm, sibling distance=2cm]
\tikzstyle{bag} = [text width=4em, text centered]
\tikzstyle{end} = [rectangle, draw=none, minimum width=3pt, inner sep=0pt]
\tikzstyle{ans} = [color=red]
\begin{tikzpicture}[level distance=5cm,
level 1/.style={sibling distance=3.5cm},
level 2/.style={sibling distance=1.2cm},
level 3/.style={level distance = 2cm},grow'=right]
\tikzstyle{every node}=[]
\node (Root) [] {Origin}
child [] {
node {Door A}
child { node {A}
child {node[end] {$0$} }
edge from parent
node[left] {$0$}
}
child [black] { node {B}
child {node[ans,end] {$\frac{1}{6}$} }
edge from parent
node[ans,left] {$\frac{1}{2}$}
}
child [black] { node {C}
child {node[ans,end] {$\frac{1}{6}$} }
edge from parent
node[ans,left] {$\frac{1}{2}$}
}
edge from parent
node[above] {$\frac{1}{3}$}
}
child {
node {Door B}
child { node {A}
child {node[ans,end] {$0$} }
edge from parent
node[ans,left] {$0$}
}
child { node {B}
child {node[end] {$0$} }
edge from parent
node[ans,left] {$0$}
}
child { node {C}
child {node[ans,end] {$\frac{1}{3}$} }
edge from parent
node[ans,left] {$1$}
}
edge from parent
node[ans,left] {$\frac{1}{3}$}
}
child {
node {Door C}
child { node {A}
child {node[ans,end] {$0$} }
edge from parent
node[ans,left] {$0$}
}
child { node {B}
child {node[ans,end] {$\frac{1}{3}$} }
edge from parent
node[ans,left] {$1$}
}
child { node {C}
child {node[end] {$0$} }
edge from parent
node[ans,left] {$0$}
}
edge from parent
node[ans,left] {$\frac{1}{3}$}
};
% How I'm applying labels to each level.
% Need to be able to dynamically align nodes at top level
\begin{scope}[every node/.style={above}]
\path (Root -| Root) ++(0,15mm) node {Test};
\path (Root-1 -| Root-1) ++(0,15mm) node {Contestant Chooses};
\path (Root-1-1 -| Root-3-3-1) ++(10mm,13mm) node {Host Reveals Door};
\path (Root-1-1-1 -| Root-3-3) ++(0,15mm) node {Probability};
\end{scope}
\end{tikzpicture}
I get this

and want this


Notice the labels for each level are aligned to the same height at the top of the diagram.
– coatless Jun 19 '14 at 20:27\begin{scope}[every node/.style={anchor=base}] \path (Root-1-1-1 -| Root) ++(0,15mm) node(a) {Test}; \path (Root-1-1-1 -| Root-1) ++(0,15mm) node {Contestant Chooses}; \path (Root-1-1-1 -| Root-3-3-1) ++(10mm,15mm) node {Host Reveals Door}; \path (Root-1-1-1 -| Root-3-3) ++(0,15mm) node(b) {Probability}; \end{scope}– Herr K. Jun 19 '14 at 21:08forest? – cfr Jun 20 '14 at 03:01