I am using the Forest package and I am trying to paint a gray background for odd and even rows, as well as a label.
I already had a version of this diagram that I wrote "manually" with tikz. But it was laid out horizontally (I want it to be vertically laid out, as in the code), and there were also some changes I wanted to make. I was trying to do it from scratch using Forest...
The code I am stuck trying to draw the background .. (I can seem to be able to paint beneath the tree ..)
\documentclass{standalone}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={draw, circle, l sep+=0.5em, inner sep=0.05em}
[,fill
[{$-$}, edge label={node[midway,left]{$0.70$}}
[$-$, edge label={node[midway,left]{$0.78$}}
[$-$, edge label={node[midway,left]{$0.80$}}
[$-$, edge label={node[midway,left]{$0.82$}}]
[$+$, edge label={node[midway,right]{$0.18$}}]
]
[$+$, edge label={node[midway,right]{$0.20$}}
[$-$, edge label={node[midway,left]{$0.49$}}]
[$+$, edge label={node[midway,right]{$0.51$}}]
]
]
[$+$, edge label={node[midway,right]{$0.22$}}
[$-$, edge label={node[midway,left]{$0.50$}}
[$-$, edge label={node[midway,left]{$0.70$}}]
[$+$, edge label={node[midway,right]{$0.30$}}]
]
[$+$, edge label={node[midway,right]{$0.50$}}
[$-$, edge label={node[midway,left]{$0.57$}}]
[$+$, edge label={node[midway,right]{$0.43$}}]
]
]
]
[{$+$}, edge label={node[midway,right]{$0.30$}}
[$-$, edge label={node[midway,left]{$0.50$}}
[$-$, edge label={node[midway,left]{$0.71$}}
[$-$, edge label={node[midway,left]{$0.75$}}]
[$+$, edge label={node[midway,right]{$0.25$}}]
]
[$+$, edge label={node[midway,right]{$0.29$}}
[$-$, edge label={node[midway,left]{$0.53$}}]
[$+$, edge label={node[midway,right]{$0.47$}}]
]
]
[$+$, edge label={node[midway,right]{$0.50$}}
[$-$, edge label={node[midway,left]{$0.50$}}
[$-$, edge label={node[midway,left]{$0.72$}}]
[$+$, edge label={node[midway,right]{$0.28$}}]
]
[$+$, edge label={node[midway,right]{$0.50$}}
[$-$, edge label={node[midway,left]{$0.44$}}]
[$+$, edge label={node[midway,right]{$0.56$}}]
]
]
]
]
\draw[draw=none,fill=black!2] (-5,-2) rectangle (5,-3);
\end{forest}
\end{document}