1

I have the requirement to draw a tree down- and then upgrowing. In pgfmanual, p. 322, the grow key is mentioned. I have no solution to specify the root/parent of the opposite side. Also there is spoken about a personally to define growth function, but there is no example. So I put two trees, one up-, the other downgrowing, in one tikz picture env. But alignment is a real horror (see xhift commands) and perhaps impossible. So, I need help to build one tree with changing growth direction. The problem for me is that I have no idea to specify the parent of some childs, that would be necessary for the connection "Genus: Brassica" coming from above species, for "Order: Asparagales" and "Class: Magnoliopsida" too. In the last case three Ordo-childs with one parent (Class...), if I grow down. I hope, if someone can solve this, that alignment would be a small challenge and "Class: Magnoliopsida" (at the end of the tree) would be centered as the other parent "Outdoor". Many thanks in advance. What I have reached so far you can see in the mwe.

    \documentclass[10pt,a4paper,table]{article}
    \usepackage[showframe,
                left=2cm, 
                right=2cm,
                bottom=1.75cm]{geometry}
                
    %%%%%----- tikz -----%%%%%
    \usepackage{tikz,fp}
    \tikzstyle{every picture,
              }+=[remember picture]
          
    \usepackage[ngerman]{babel}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc} % \"a usw. !!!
    \usepackage[figurename=Abb.]{caption}
    \begin{document}
    
    \tikzstyle{every picture}+=[remember picture]
    \begin{figure}[h]\centering
       \begin{tikzpicture}[%sibling distance=15em,
                           level distance=25mm,
       every node/.style = {shape=rectangle, rounded corners,
          draw, align=left, inner sep=4pt,
          top color=white, bottom color=blue!20,
       },
       level 1/.style={sibling distance=10em},
       ]
       \node {\textsc{Outdoor Freilandflächen} 112.000 ha\\
              \textsc{Ernte:} 3.2 Mio to\\
              \textsc{Betriebe ges.:} 6.600\\
              \textsc{Ökologisch:} 1.100
             }
             child { node (spargel) {\textsc{Spargel:}\\ 24.000 ha\\  100.000 to} }
             child { node (zwiebel) {\textsc{Speisezwiebeln:}\\ 9.700 ha\\} }
             child { node (moehren) {\textsc{Möhren:}\\ 10.200 ha\\} }
             child { node (weisskohl) {\textsc{Weißkohl:}\\ 5.800 ha\\} } %
             child { node (blumenkohl) {\textsc{Blumenkohl:}\\ 4.200 ha\\} } %
       ;
    \end{tikzpicture}
    %
    %
    \begin{tikzpicture}
    [level distance=20mm,
     every node/.style = {shape=rectangle, rounded corners,
                          draw, align=left, inner sep=4pt,
                          top color=white, bottom color=blue!20,
                        },
     level 1/.style={sibling distance=15em},
    ]
    \node[xshift=250mm] {\textsc{Class:}\\    Magnoliopsida %xhift doesn't work
          }[grow=up]
    %
    child {node[xshift=30mm]{\textsc{Ordo:}\\ \textit{Brassicales} }
           child {node {\textsc{Familia:}\\ \textit{Brassicaceae:} } 
                  child {node{\textsc{Subfamilia:}    \\ \textit{missing} }
                         child {node{\textsc{Tribus:}    \\ \textit{missing} }
                                child {node {\textsc{Genus:}\\ \textit{Brassica} }
                                       child {node[xshift=-10mm] (sblumenkohl){\textsc{Species:}\\
                                                                               \textit{Brassica oleracea} \\var.
                                                                               \textit{botrytis}    
                                                                               \textsc{L.} \\ }
                                             }
                                       child {node[xshift=08mm] (sweisskohl){\textsc{Species:}\\       
                                                                             \textit{Brassica oleracea} \\convar.
                                                                             \textit{capitata} \\var.   
                                                                             \textit{alba}  
                                                                             \textsc{L.} 
                                                                            }
                                             }
                                      }
                               } 
                        }
                 }
          } %ende ordo Brassicales 
    child {node[xshift=28mm] {\textsc{Ordo:}\\ Apiales }
           child {node {\textsc{Familia:}\\ \textit{Apiaceae:} } 
                  child {node{\textsc{Subfamilia:} \\ \textit{missing} }
                         child {node{\textsc{Tribus:}  \\ \textit{missing} }
                                child {node {\textsc{Genus:}\\ \textit{Daucus} \textsc{L.} 1753 } 
                                       child {node(smoehren){\textsc{Species:} \\ \textit{Daucus carota} \\ssp. \textit{sativus} \\ }
                                             }
                                      }     
                               }     
                        } 
                 } 
          } %ende apiales
    % 
    %
    child {node[xshift=12mm]{\textsc{Ordo:}\\ \textit{Asparagales}\\ }
           child {node[xshift=09mm]{\textsc{Familia:}\\ \textit{Amaryllidaceae:} } 
                  child {node{\textsc{Subfamilia:} \\ \textit{Allioideae} }
                         child {node {\textsc{Tribus:}\\ \textit{Allieae} }  
                                child {node{\textsc{Genus:} \\ \textit{Allium} \textsc{} }
                                       child {node(szwiebel){\textsc{Species:} \\ \textit{Allium cepa} \textsc{}\\ \\ }
                                             }
                                      }
                               }
                        }  
                 } 
    %
           child {node[xshift=27mm] {\textsc{Familia:}\\ \textit{Asparagaceae:} } 
                  child {node[xshift=0mm]{\textsc{Subfamilia:}  \\ \textit{Asparagoideae} }
                         child {node[xshift=0mm]{\textsc{Tribus:} \\ \textit{missing} }
                                child {node[xshift=0mm] {\textsc{Genus:} \\ \textit{Asparagus} } 
                                       child {node[xshift=0mm](sspargel){\textsc{Species:} \\ \textit{Asparagus}  \\ \textit{officinalis} \textsc{L.}\\ }
                                             }
                                      }
                               }
                        }
                 } 
          } %ende ordo asparagales 
    ;  
    
    \draw [shorten >=0pt,thick] (zwiebel.south) -- (szwiebel.north);
    \draw [shorten >=0pt,thick] (spargel.south) -- (sspargel.north);
    \draw [shorten >=0pt,red,thick,dashed] (moehren.south) -- (smoehren.north);
    \draw [shorten >=0pt,green,thick,dashed] (weisskohl.south) -- (sweisskohl.north);
    \draw [shorten >=0pt,red,thick,dashed] (blumenkohl.south) -- (sblumenkohl.north);
    
    \end{tikzpicture}
       
    \caption[Übersicht \textit{Gemüse BRD 2013} \textsc{}] {Übersicht \textit{Gemüse BRD 2013} }
    \end{figure}
    \end{document}
    

enter image description here

1 Answer 1

4

For drawing of your tree I would use forest package and for it define tree grow only to south, i.e. have only one tree. The nodes common to some branches of forest are place in pair with phantom node (node "Ordo") or coordinate (node "Genus"). Nodes at the end of branches are named (from aux1 to aux6). Those names are used in drawing of lines which are not drawn as edges in forest.

Edit: At use of the siunitx are defined range-units = single, group-minimum-digits=4, group-separator={.}. By this is unified writing of numbers and have shorter quantity range.

\documentclass[a4paper]{article}
\usepackage[showframe,
            hmargin=2cm,
            bottom=1.75cm]{geometry}
\usepackage[T1]{fontenc}

\usepackage[edges]{forest}
\usepackage[ngerman]{babel}
\usepackage[figurename=Abb.]{caption}
\usepackage{siunitx}    % used is v3

\begin{document}
    \begin{figure}[ht]
    \centering
    \sisetup{range-units = single,
             group-minimum-digits=4,
             group-separator={.}
             }
\begin{forest}
for tree = {
% nodes
    draw,
    rounded corners,
    top color=white, bottom color=blue!20,
    minimum width=8em,
    align=left, 
% tree
    grow=south,
    forked edge,    % for forked edge
    s sep = 2mm,    % "sibling" distance
    l sep = 4mm,    % "level" distance
 fork sep = 2mm,    % distance from parent to branching point
            },
[\textsc{Outdoor Freilandflächen} \qty{112 000}{ha}\\
 \textsc{Ernte:} 3.2 Mio to\\
 \textsc{Betriebe ges.:} 6.600\\
 \textsc{Ökologisch:} 1.100
    [\textsc{Spargel:}\\
     \qtyrange{24 000}{100 000}{ha}
        [\textsc{Species:}  \\
         \textit{Asparagus} \\
         \textit{officinalis} L.\\ ~
             [\textsc{Genus:} \\
              \textit{Asparagus}
                [\textsc{Tribus:} \\
                 \textit{missing}
                    [\textsc{Subfamilia:}  \\
                     \textit{Asparagoideae}
                        [\textsc{Familia:}\\
                         \textit{Asparagaceae:}
                            [,phantom]
                            [\textsc{Ordo:}\\ \textit{Asparagales}, name=aux1]
                         ]
                    ]
                ]
             ]
        ]
    ]
    [\textsc{Speisezwiebeln:}\\ 
     \qty{9 700}{ha}
        [\textsc{Species:} \\
         \textit{Allium cepa}\\ ~\\~
            [\textsc{Genus:} \\
             \textit{Allium}
                [\textsc{Tribus:}\\
                 \textit{Allieae}
                    [\textsc{Subfamilia:} \\
                     \textit{Allioideae}
                        [\textsc{Familia:}\\ \textit{Amaryllidaceae:}, name=aux2]
                    ]
                 ]
            ]
        ]
    ]
    [\textsc{Möhren:}\\ 
     \qty{10 200}{ha}
        [\textsc{Species:} \\
         \textit{Daucus carota}\\
         ssp. \textit{sativus}\\ ~
            [\textsc{Genus:}\\
             \textit{Daucus} L. 1753
                [\textsc{Tribus:}  \\
                 \textit{missing}
                    [\textsc{Subfamilia:} \\
                     \textit{missing}
                        [\textsc{Familia:}\\
                         \textit{Apiaceae:}
                            [\textsc{Ordo:}\\ \textit{Apiales}, 
                                [\textsc{Class:}\\
                                 \textit{Magnopoliopsida},name=aux3]
                            ]
                        ]
                    ]
                ]
            ]
        ]
    ]
    [\textsc{Weißkohl:}\\ 
     \qty{5 800}{ha}      
        [\textsc{Species:}\\
         \textit{Brassica oleracea} \\
         convar. \textit{capitata} \\
         var. \textit{alba} L.
            [,coordinate, no edge] 
            [\textsc{Genus:}\\ 
             \textit{Brassica}, name=aux5
                [\textsc{Tribus:}\\ 
                 \textit{missing} 
                    [\textsc{Subfamilia:}\\ 
                     \textit{missing} 
                        [\textsc{Familia:}\\ 
                         \textit{Brassicaceae:} 
                            [\textsc{Ordo:}\\ 
                             \textit{Brassicales}, name=aux6]
                        ]
                    ]
                ]
            ]
        ]
    ]
    [\textsc{Blumenkohl:}\\ 
     \qty{4 200}{ha}     
        [\textsc{Species:}\\
         \textit{Brassica oleracea} \\
         var. \textit{botrytis} L. \\ ~, name=aux4] 
    ]
]
\draw   ([xshift=1em] aux1.north) -- ++ (0,0.2) -| (aux2);
\draw   (aux1.south) -- ++ (0,-0.2) -| ([xshift=-1em] aux3.north);
\draw   (aux4.south) -- ++ (0,-0.2) -| ([xshift=+1em] aux5.north);
\draw   (aux6.south) -- ++ (0,-0.2) -| ([xshift=+1em] aux3.north);
\end{forest}
\caption[Übersicht \textit{Gemüse BRD 2013} \textsc{}] {Übersicht \textit{Gemüse BRD 2013} }
\label{fig:ubershicht}
    \end{figure}
\end{document}

enter image description here

3
  • You have reached the aim. Great, in less than 2 hours! I don't understand all of your code, yet. I see that there was eliminated the up/down growing problems. Thank you for all!
    – gizeh
    Commented Jun 9, 2021 at 16:41
  • @gizeh, most of the time I need to rearrange order of child orders, after this I only need to replace child and node by [, remove all superfluous curly braces and add close ] for determining/terminate nodes in branches. A quite error prone task :-(. I hope, that all nodes are in correct place :-).
    – Zarko
    Commented Jun 9, 2021 at 17:10
  • They are, well done:-)
    – gizeh
    Commented Jun 9, 2021 at 17:14

You must log in to answer this question.

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