1

Please help me to set a straight line (horizontal) connector. Thank you in advance. enter image description here

\documentclass[a4paper,11pt]{article}
\usepackage[edges]{forest}
\usepackage{caption}
% Source <------------- https://tex.stackexchange.com/questions/300373/saving-horizontal-space-in-tree-diagram

%Defining tikz classes for tree diagrams \tikzset{parent/.style={align=center,text width=3cm,rounded corners=3pt}, child/.style={align=center,text width=3cm,rounded corners=3pt} }

\colorlet{col1}{white} \colorlet{col2}{gray!20} \colorlet{col3}{gray!40} \colorlet{col4}{gray!60}

\begin{document} \begin{center} \resizebox*{.75\linewidth}{!}{% \begin{forest} forked edges, for tree={ grow'=east, draw, rounded corners, text width=2.7cm, node options={align=center}, }
[TEXT, fill=col4, parent, s sep=1cm [TEXT TEXT, for tree={child, fill=col3} [TEXT\ TEXT, for tree={child, fill=col2} [{TEXT\ TEXT, TEXT \ TEXT, TEXT \ TEXT, TEXT \ TEXT, TEXT \ TEXT}]] [TEXT \ TEXT, for tree={child, fill=col2} [{TEXT \ TEXT, TEXT \ TEXT}]] [TEXT-\TEXT, for tree={child, fill=col2} [{TEXT \TEXT, TEXT \TEXT}]] [TEXT\TEXT, for tree={child, fill=col2} [{TEXT \TEXTg, TEXT \TEXT}]] [TEXT\ TEXT, for tree={child, fill=col2} [{TEXT \TEXT, TEXT \TEXT}]] ] [TEXT TEXT, for tree={child, fill=col3} [TEXT\ TEXT, for tree={child, fill=col2} [{TEXT\ TEXT, TEXT \ TEXT, TEXT \ TEXT, TEXT \ TEXT, TEXT \ TEXT}]] [TEXT \ TEXT, for tree={child, fill=col2} [{TEXT \ TEXT, TEXT \ TEXT}]] [TEXT-\TEXT, for tree={child, fill=col2} [{TEXT \TEXT, TEXT \TEXT}]] [TEXT\TEXT, for tree={child, fill=col2} [{TEXT \TEXTg, TEXT \TEXT}]] [TEXT\ TEXT, for tree={child, fill=col2} [{TEXT \TEXT, TEXT \TEXT}]] ] ] ] ] \end{forest}} \captionsetup{type=figure} \captionof{figure}{Caption.} \label{tikz:taxonomy} \end{center} \end{document}

1 Answers1

2

enter image description here

\documentclass[a4paper,11pt]{article}
\usepackage[edges]{forest}
\usepackage{caption}
% Source <------------- https://tex.stackexchange.com/questions/300373/saving-horizontal-space-in-tree-diagram

%Defining tikz classes for tree diagrams \tikzset{parent/.style={align=center,text width=3cm,rounded corners=3pt}, child/.style={align=center,text width=3cm,rounded corners=3pt} }

\colorlet{col1}{white} \colorlet{col2}{gray!20} \colorlet{col3}{gray!40} \colorlet{col4}{gray!60}

\begin{document} \begin{center} \resizebox*{.75\linewidth}{!}{% \begin{forest} forked edges, for tree={ grow'=east, draw, rounded corners, text width=2.7cm, node options={align=center},anchor=parent }
[TEXT, fill=col4, parent, s sep=1cm [TEXT TEXT, for tree={child, fill=col3} [TEXT\ TEXT, for tree={child, fill=col2} [{TEXT\ TEXT, TEXT \ TEXT, TEXT \ TEXT, TEXT \ TEXT, TEXT \ TEXT}]] [TEXT \ TEXT, for tree={child, fill=col2} [{TEXT \ TEXT, TEXT \ TEXT}]] [TEXT-\TEXT, for tree={child, fill=col2} [{TEXT \TEXT, TEXT \TEXT}]] [TEXT\TEXT, for tree={child, fill=col2} [{TEXT \TEXTg, TEXT \TEXT}]] [TEXT\ TEXT, for tree={child, fill=col2} [{TEXT \TEXT, TEXT \TEXT}]] ] [TEXT TEXT, for tree={child, fill=col3} [TEXT\ TEXT, for tree={child, fill=col2} [{TEXT\ TEXT, TEXT \ TEXT, TEXT \ TEXT, TEXT \ TEXT, TEXT \ TEXT}]] [TEXT \ TEXT, for tree={child, fill=col2} [{TEXT \ TEXT, TEXT \ TEXT}]] [TEXT-\TEXT, for tree={child, fill=col2} [{TEXT \TEXT, TEXT \TEXT}]] [TEXT\TEXT, for tree={child, fill=col2} [{TEXT \TEXTg, TEXT \TEXT}]] [TEXT\ TEXT, for tree={child, fill=col2} [{TEXT \TEXT, TEXT \TEXT}]] ] ] ] ] \end{forest}} \captionsetup{type=figure} \captionof{figure}{Caption.} \label{tikz:taxonomy} \end{center} \end{document}

js bibra
  • 21,280