Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Thanks for helping me out.

How can I make the following tree-diagrams?


share|improve this question
See also this related question, Probability tree using TikZ for Bernoulli experiments?. –  chl Jun 4 '11 at 19:11

2 Answers 2

There is a nice example of a probability tree on TeXample.net. That might help you get started.

share|improve this answer
Isn't this more of a comment than an answer? –  Svend Tveskæg Jun 7 at 8:48
@Svend Well, I though it was an answer (albeit short) but I see no problem if a mod convert it to a comment. –  chl Jun 8 at 11:21
I'm not saying that is a comment; I'm just asking. :) –  Svend Tveskæg Jun 8 at 12:17

A forest solution though there are better versions around if you search, I think. This is not exactly like the image you linked to because that one seems rather ugly to me. Obviously, you can adjust this if you prefer greater ugliness.

  left marble colour/.store in=\leftmarblecolour,
  right marble colour/.store in=\rightmarblecolour,
  left marble colour=black,
  right marble colour=red,
  probability tree/.style={
    for tree={
      s sep+=2.5mm,
      if n=1{
        before typesetting nodes={
          edge label/.wrap pgfmath arg={node [midway, below, font=\scriptsize, text=black] {##1}}{content()},
        before typesetting nodes={
          edge label/.wrap pgfmath arg={node [midway, above, font=\scriptsize, text=black] {##1}}{content()},
      before packing={
        typeset node,
    for descendants={
      if n=1{make descendant marble=\leftmarblecolour}{make descendant marble=\rightmarblecolour},
    before drawing tree={
      for tree={
        if n children=0{
  marble/.style={circle, minimum width=2.5pt, fill=#1, draw=#1, inner sep=0pt},
  make descendant marble/.style={
    delay n={int(level())}{
      for descendants={
        if n children=0{
          append={[, grow=0, marble=#1, no edge, l+=-10mm]}
  probability tree,
  left marble colour=blue
  [, name=t0 [\nicefrac{3}{5}[\nicefrac{5}{9}][\nicefrac{4}{9}]][\nicefrac{2}{5}, name=t1 [\nicefrac{2}{3}][\nicefrac{1}{3}, name=t2]]]
  \foreach \i/\j/\k/\l [count=\n] in {3/5/5/9,3/5/4/9,2/5/2/3,2/5/1/3}
    \node (l\n) at (n\n) [label={[label distance=2.5mm, inner sep=0pt, , font=\scriptsize]right:$\frac{\i}{\j}.\frac{\k}{\l}$}] {};
  \coordinate [above=7.5mm of t2] (m1);
  \path [draw, fill, font=\scriptsize\itshape] (m1 -| t0) circle (1pt) -- (m1 -| t1) node [midway, below] {first}  circle (1pt) -- (m1 -| t2) node [midway, below] {second}  circle (1pt) -- ([xshift=2.5mm]m1 -| n3) node [midway, below] {result} circle (1pt) -- ++(7.5mm,0) node [midway, below] {\phantom{l}p\phantom{l}} circle (1pt);

probability tree

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.