0

I would love to have a nice tikz-version of this drawing of a binomial tree. enter image description here

and my lines are not that nice, can anybody help me

So far I've made the following:

\documentclass{standalone}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{pgf,tikz}
\usetikzlibrary{positioning}
\begin{document}

% Set the overall layout of the tree \tikzstyle{level 1}=[level distance=2cm, sibling distance=2cm] \tikzstyle{level 2}=[level distance=2cm, sibling distance=2cm] \tikzstyle{level 3}=[level distance=2cm, sibling distance=2cm]

% Define styles for bags and leafs \tikzstyle{bag} = [text width=2em, text centered] \tikzstyle{edge from parent}=[draw] \tikzstyle{end} = [text width=3em, text centered] %\tikzstyle{every node}=[fill=red!30,rounded corners]

% The sloped option gives rotated edge labels. Personally % I find sloped labels a bit difficult to read. Remove the sloped options % to get horizontal labels.

\begin{tikzpicture}[grow=right, sloped, edge from parent] \node[bag] {$S_{0}$} % First bag child{node[bag] {$S_{0}d$} % Step 1 down child{node[bag]{$S_{0}d^{2}$} % step 2 down child{node[end]{$S_{0}d^{3}$}} % step 3 down child{node[end] {}} % step 3 up } child{node[bag] {} % step 2 up child{node[end]{}} %step 3 down child{node[end] {}} %step 3 up } } child {node[bag] {$S_{0}u$} % step 1 up child{node[bag]{$S_{0}ud$} child{node[end]{$S_{0}ud^{2}$}} % step 3 down child{node[end]{}} % step 3 up } % step 2 down child{node[bag ]{$S_{0}u^{2}$} % step 2 up child{node[end]{$S_{0}u^{2}d$}} % step 3 down child{node[end]{$S_{0}u^{3}$}} % step 3 up } }; \end{tikzpicture}

\end{document}

GHG
  • 3

1 Answers1

1

You can add

  edge from parent/.style={draw,
    edge from parent path={
      (\tikzparentnode.east) -- (\tikzchildnode.west)
    }
  }

in the option list of tikzpicture. enter image description here

ZhiyuanLck
  • 4,516