In this binomial tree I have 4 columns of nodes.
I want the entire last column to be highlighted with light blue, and perhaps a border around this highlighting. Something like a opaque blue-ish rectangle or thin oval highlighting the entire last column of nodes.
Just started with TikZ and nothing is working so far.
I'm using pdfLaTeX.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}[>=stealth,sloped]
\matrix (tree) [%
matrix of nodes,
minimum size=1cm,
column sep=3.5cm,
row sep=1cm,
]
{
& & & $^\tau S_0$ \\
& & $^{2\Delta t}S_0$ & \\
& $^{\Delta t}S_0$ & & $^\tau S_1$ \\
$^0S_0$ & & $^{2\Delta t}S_1$ & \\
& $^{\Delta t}S_1$ & & $^\tau S_2$ \\
& & $^{2\Delta t}S_2$ & \\
& & & $^\tau S_2$ \\
};
\draw[->] (tree-4-1) -- (tree-3-2) node [midway,above] {$p$};
\draw[->] (tree-4-1) -- (tree-5-2) node [midway,below] {$1-p$};
\draw[->] (tree-3-2) -- (tree-2-3) node [midway,above] {};
\draw[->] (tree-3-2) -- (tree-4-3) node [midway,below] {};
\draw[->] (tree-5-2) -- (tree-4-3) node [midway,above] {};
\draw[->] (tree-5-2) -- (tree-6-3) node [midway,below] {};
\draw[->] (tree-2-3) -- (tree-1-4) node [midway,above] {};
\draw[->] (tree-2-3) -- (tree-3-4) node [midway,below] {};
\draw[->] (tree-4-3) -- (tree-3-4) node [midway,above] {};
\draw[->] (tree-4-3) -- (tree-5-4) node [midway,below] {};
\draw[->] (tree-6-3) -- (tree-5-4) node [midway,above] {};
\draw[->] (tree-6-3) -- (tree-7-4) node [midway,below] {};
\end{tikzpicture}
\end{document}
Best Answer
Here are two solutions. First solution uses
column 4
style to add a border and to fill each node in fourth column of your matrix. Second solution usesfit
andbackground
libraries to put a new node on background fittingtree-1-4
andtree-7-4
nodes.Edit: Here is another method to position your nodes (using
positioning
instead ofmatrix
).