1

How do I draw a tree-like figure similar to the one below please?

enter image description here

arilwan
  • 389
  • What have you tried so far? Please add a MWE of your current code. The forest package should work for example. – epR8GaYuh Nov 25 '19 at 14:52

2 Answers2

2

With forest is simple:

\documentclass[margin=3mm]{standalone}
\usepackage[edges]{forest}

\begin{document}
    \begin{forest}
for tree = {
    draw, 
    text width= 22mm,
    text centered,
%    
    s sep = 3mm,
    l sep = 4mm,
    forked edge,
    fork sep=2mm
            }
[Main Tree
    [Sub-tree 1\\   \scriptsize Some text]
    [Sub-tree 2\\   \scriptsize Some text]
    [Sub-tree 3\\   \scriptsize Some text]
]
    \end{forest}
\end{document}

enter image description here

Zarko
  • 296,517
1

With some ideas coming from this question, you can obtain such a structure like this:

\documentclass{standalone}

\usepackage{tikz}
    \usetikzlibrary{trees}

\begin{document}


    \begin{tikzpicture}[
        sibling distance = 10em,
        every node/.style = {%
            shape = rectangle,
            align = center,
            draw
        },
        edge from parent fork down
    ]

        \node {Main Tree}
            child {node {Sub-tree 1\\{\scriptsize Some text}}}
            child {node {Sub-tree 2\\{\scriptsize Some text}}}
            child {node {Sub-tree 3\\{\scriptsize Some text}}};

    \end{tikzpicture}

\end{document}

enter image description here

You can adapt the distance between the nodes at the same level by changing the value of the sibling distance option and you can also change the distance between two levels by adding a level distance option. Finally, you can change the way your nodes are display by adding to the every node style.

For more, you can refer to the PGF/TikZ documentation and more precisely, to the trees library sections.

KersouMan
  • 1,850
  • 3
  • 13
  • 15