6

do you have an idea how could I reproduce the brancing-diagram in this picture? I suppose that it was made with tikz or pst-tree but I don't know how, especially how to get those coloured areas.

Branching diagram I want to reproduce

The tree in the picture is taken from this presentation

MWE (produces almost the same tree but not the coloured areas):

\documentclass[11pt]{standalone}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,decorations.pathmorphing,trees}


\begin{document}

\vspace{5cm}
\tikzstyle{level 1}=[level distance=3cm, sibling distance=3cm,very thick]
\tikzstyle{level 2}=[level distance=3cm, sibling distance=2cm]
\tikzstyle{level 3}=[level distance=3cm, sibling distance=1.5cm]

\tikzstyle{empty node} = [circle,draw,minimum width=1pt,fill=white,inner sep=2pt]
\tikzstyle{end} = [circle,draw,inner sep=1.2,fill=black, minimum width=2pt]

\begin{tikzpicture}[grow=right, sloped]
\node[end] {}
child[loosely dotted] {
    node[end] {}        
    child{
        node[end]{}
        child{
            node[end] {}
        }
        child{
            node[end] {}
        }
    }
    child {
        node[end] {}
            child{
            node[end] {}
            }
            child{
            node[end] {}
            }
        }
}
child[loosely dotted]{
    node[end]{}
    child{
        node[end] {}
    }
    child{
        node[end] {}
    }
}
child {
    node[empty node,label=above:{\Large{\textit{i}$_c$}}] {}
    child[loosely dashed] {
        node[end] {}
        child{
            node[end]{}
            child{
                node[end]{}    
            }
            child{
                node[end]{}    
            }
        }
    }
    child[dashed]{
        node[end] {}
        child{
        node[end]{}
        child{
        node[end]{}    
    }
        child{
        node[end]{}    
    }
    }
    }
}
;
\end{tikzpicture}
\end{document}

Thank you very much in advance!!!

Tonio
  • 133

1 Answers1

5

Your code doesn't produce a tree with the structure shown, at least when I compile it, and it isn't clear how to apply the shading to your tree. So, I adapted it to produce the illustrated structure, after translating it to Forest. The backgrounds library is used for the shadings. Most of the packages and libraries you list in your code are egregious.

\documentclass[border=10pt,11pt]{standalone}
\usepackage{forest}
\usetikzlibrary{backgrounds}
\begin{document}
\tikzset{% \tikzstyle is deprecated
  empty node/.style = {circle,draw,minimum width=1pt,fill=white,inner sep=2pt},
  end/.style = {circle,draw,inner sep=1.2,fill=black, minimum width=2pt,},
}%
\begin{forest}
  for tree={
    grow=0,
    edge+={loosely dotted, very thick},
    end,
    s sep'=5mm,
    fit=band,
  },
  where level<=1{calign=fixed edge angles}{},
  before drawing tree={
    tempdima/.max={x}{tree},
    where n children=0{x/.register=tempdima}{},
  }
  [
    [
      [[[][]][[][]]]
      [[[][]][[][]]]
    ]
    [
      [
        [[][]][[][]]
      ]
      [
        [[][]][[][]]
      ]
      [, for current and ancestors={edge+={solid}}, empty node, very thick, label=above:{\Large{\textit{i}$_c$}}
        [, for tree={edge+={loosely dashed}} [[][]]]
        [, for tree={edge+={dashed}} [[][]]]
      ]
    ]
  ]
  \begin{scope}[on background layer]
    \begin{scope}[transparency group, opacity=.25]
      \draw [blue, line width=30pt, line cap=round] (!r) -- (!rll);
      \node [fit=(!rlll) (!rll1) (!rlllll) (!rll111), fill=green, rounded corners] {};
      \path [fill, draw, magenta, line width=20pt, rounded corners] (!r1.center) -- (!r111.center) -- (!rF.center) -- (!rl2L.center) -- (!rl2l.center) -- (!rl2.center) -- cycle;
    \end{scope}
  \end{scope}
\end{forest}
\end{document}

shaded tree

cfr
  • 198,882