I am creating a decision tree with flow chart in the using the tikz-package. A MWE is as follow:
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{positioning}
\newdimen\nodeDist
\nodeDist=35mm
\begin{document}
\pagestyle{empty}
\tikzstyle{block} = [rectangle, draw, fill=white!20,
text width=10em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, very thick, color=black!50, -latex']
\begin{tikzpicture}[
node/.style={%
draw,
},
]
\node [node] (A) {Both HF and LF waves important?};
\path (A) ++(-135:\nodeDist) node [node] (B) {Phase averaged};
\path (B) ++(-90:\nodeDist) node [node] (I) {nonlinearity?};
\path (A) ++(-45:\nodeDist) node [node] (C) {Phase resolving};
\path (C) ++(-90:\nodeDist) node [node] (D) {Is it complex?};
\path (D) ++(-90:\nodeDist) node [node] (E) {Spectral?};
\path (E) ++(-45:\nodeDist) node [node] (F) {NH, Boussinesq};
\path (E) ++(-135:\nodeDist) node [node] (G) {Large gradient?};
\path (G) ++(-45:\nodeDist) node [node] (H) {mild slope};
\path (I) ++(-135:\nodeDist) node [node] (J) {SWE + groups};
\path (I) ++(-45:\nodeDist) node [node] (K) {energies};
\draw (A) -- (B) node [left,pos=0.25] {no}(A);
\draw (A) -- (C) node [right,pos=0.25] {yes}(A);
\draw (D) -- (E) node [right , pos = 0.25]{yes/no} (D);
\draw (E) -- (F) node [right, pos = 0.25]{yes} (E);
\draw (E) -- (G) node [left, pos = 0.25]{no} (E);
\draw (G) -- (F) node [above, pos = 0.5]{yes} (G);
\draw (G) -- (H) node [right, pos=0.25]{no} (G);
\draw (D) -- (I) node [above , pos = 0.5]{no*} (D);
\draw (I) -- (J) node [left, pos = 0.25]{yes} (I);
\draw (I) -- (K) node [right, pos = 0.25]{no} (I);
\draw (B) -- (I);
\draw (C) -- (D) ;
\end{tikzpicture}
\end{document}
The problems associated with this decision tree are:
- there are no arrows from one path (node) to another.
- the blocks (or nodes) does not have rounded corners as I have defined.
- the decision tree looks a little bit clumsy, I do not like the diagonal lines. I prefer straight lines.
- The end of the left part (phase averaged) does not have the same 'ending height' as the 'phase-resolving' part.
Preferably, I would like to have something that looks like this (more organised, less clumsy):
I am already stuck on it for a while. How to proceed further?
Best Answer
I don't understand all the desiderata. I also don't know if an alternative approach is an option. But, for whatever it is worth, here's a
forest
solution.This satisfies the first 3 desiderata, in addition to applying the defined styles correctly. Whether it satisfies the fourth of the desiderata I cannot say. Since I don't understand that one, if it satisfies it, it does so purely by accident. If not, that is entirely to be expected.