\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
\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}