1

I use the code found here To draw a hierarchy tree diagram

\documentclass[tikz,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
  for tree={
    align=center,
    font=\sffamily,
    edge+={thick, -{Stealth[]}},
    l sep'+=10pt,
    fork sep'=10pt,
  },
  forked edges,
  if level=0{
    inner xsep=0pt,
    tikz={\draw [thick] (.children first) -- (.children last);}
  }{},
  [Angiography Based On Medical Imaging Modalities
    [Biplane\\X-Ray/DSA]
    [Magnetic\\Resonance
      [Contrast Enhanced]
      [Non-Contrast Enhanced
        [Time of Flight]
        [Black-Blood]
        [Phase Contrast]
        [T2]
        [T2\textsuperscript{*}]
      ]
    ]
    [Computed-\\Tomography, calign with current]
    [Ultrasound]
    [Fusion of\\Modalities]
  ]
\end{forest}
\end{document}

which produces

enter image description here

How should I modify the code to get a result as follows

enter image description here

Thank you very much!

EDIT

MWE to create the first three levels:

\documentclass[tikz,french]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}

\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
    for tree={
        align=center,
        font=\sffamily,
        edge+={thick, -{Stealth[]}},
        l sep'+=10pt,
        fork sep'=10pt,
    },
    forked edges,
    if level=0{
        inner xsep=0pt,
        tikz={\draw [thick] (.children first) -- (.children last);}
    }{},
    [{\bf Question:} Quels sont les facteurs contribuant à des taux d'échec\\élevés en cours de mécanique de première année?
    [Qu'est-ce\\qui a déjà\\été fait?
    [Revue de\\littérature]
    ]
    [Cours typique\\en mécanique\\de 1e année?
    [``Benchmarking''\\de cours]
    ]
    [Sujets\\probléma-\\tiques?
    [Analyser\\ le travail\\
    des étudiants]
    ]
    [Où le problème\\pourrait-il\\commencer?
    [Analyser\\le dossier\\
    universitaire]
    ]
    ]
\end{forest}
\end{document}

I cannot figure out how to include the fourth level emanating from the third level (enumeration starting from above).

1 Answer 1

3

The structures of the diagrams are very different, but if you want to draw the boundaries and have the nodes all the same height (at level 1), you might just add draw, where level=1{minimum height=8ex,anchor=north}{},

MWE:

\documentclass[tikz,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
  for tree={draw,
  where level=1{minimum height=8ex,anchor=north}{},
    align=center,
    font=\sffamily,
    edge+={thick, -{Stealth[]}},
    l sep'+=10pt,
    fork sep'=10pt,
  },
  forked edges,
  if level=0{
    inner xsep=0pt,
    tikz={\draw [thick] (.children first) -- (.children last);}
  }{},
  [Angiography Based On Medical Imaging Modalities
    [Biplane\\X-Ray/DSA]
    [Magnetic\\Resonance
      [Contrast Enhanced]
      [Non-Contrast Enhanced
        [Time of Flight]
        [Black-Blood]
        [Phase Contrast]
        [T2]
        [T2\textsuperscript{*}]
      ]
    ]
    [Computed-\\Tomography, calign with current]
    [Ultrasound]
    [Fusion of\\Modalities]
  ]
\end{forest}
\end{document}

enter image description here

or just add an empty line in the Ultrasound node

\documentclass[tikz,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
  for tree={draw,
    align=center,
    font=\sffamily,
    edge+={thick, -{Stealth[]}},
    l sep'+=10pt,
    fork sep'=10pt,
  },
  forked edges,
  if level=0{
    inner xsep=0pt,
    tikz={\draw [thick] (.children first) -- (.children last);}
  }{},
  [Angiography Based On Medical Imaging Modalities
    [Biplane\\X-Ray/DSA]
    [Magnetic\\Resonance
      [Contrast Enhanced]
      [Non-Contrast Enhanced
        [Time of Flight]
        [Black-Blood]
        [Phase Contrast]
        [T2]
        [T2\textsuperscript{*}]
      ]
    ]
    [Computed-\\Tomography, calign with current]
    [Ultrasound\\~]
    [Fusion of\\Modalities]
  ]
\end{forest}
\end{document}

enter image description here

As for your addendum to the question:

 \documentclass[tikz,french]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}

\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta,positioning}
\begin{document}
\begin{forest}
    for tree={
        align=center,
        font=\sffamily,
        edge+={thick, -{Stealth[]}},
        l sep'+=10pt,
        fork sep'=10pt,
    },
    forked edges,
    if level=0{
        inner xsep=0pt,
        tikz={\draw [thick] (.children first) -- (.children last);}
    }{},
    [{\bf Question:} Quels sont les facteurs contribuant à des taux d'échec\\élevés en cours de mécanique de première année?
    [Qu'est-ce\\qui a déjà\\été fait?
    [Revue de\\littérature,alias=A1]
    ]
    [Cours typique\\en mécanique\\de 1e année?
    [``Benchmarking''\\de cours,alias=A2]
    ]
    [Sujets\\probléma-\\tiques?
    [Analyser\\ le travail\\
    des étudiants,alias=A3]
    ]
    [Où le problème\\pourrait-il\\commencer?
    [Analyser\\le dossier\\
    universitaire,alias=A4]
    ]
    ]
\path (A3.south) -- (A2|-A3.south) coordinate[midway,below=10pt] (aux);
\node[anchor=north,below=15pt of aux] (D) {Dimitris};   
\foreach \X in {1,...,4}
{\draw[thick, -{Stealth[]}] (A\X) |- (aux) -- (D);}
\end{forest}
\end{document}

enter image description here

7
  • Thanks. I have provided a MWE that creates the first three levels of the desired image but I cannot figure out how to include the fourth level.
    – Dimitris
    May 1, 2019 at 16:24
  • @Dimitris I added a proposal.
    – user121799
    May 1, 2019 at 18:10
  • THANKS A LOT. (Merci beaucoup:-)!). So If I combine your original solution with the new one I can a perfect result! I will try to make it on my own.
    – Dimitris
    May 1, 2019 at 18:12
  • Ok. It was easy. I just need to add draw:-)! Thanks again. Just one last question. How to put Dimitris inside a rectangle?
    – Dimitris
    May 1, 2019 at 18:28
  • @Dimitris Add draw: \node[draw,anchor=north,below=15pt of aux] (D) {Dimitris};
    – user121799
    May 1, 2019 at 18:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .