![简单思维导图组合树](https://linux22.com/image/299761/%E7%AE%80%E5%8D%95%E6%80%9D%E7%BB%B4%E5%AF%BC%E5%9B%BE%E7%BB%84%E5%90%88%E6%A0%91.png)
我想将简单的思维导图与树结合起来。
首先,我尝试从以下思维导图获取pgf 手册第 79 页:
感谢 @cfr,我可以让思维导图正常工作。使用来自 TikZ 和 PGF 文档的源代码。问题是我无法获得如此简单的版本,它总是带有像第 82 页那样的颜色。:(
现在唯一的问题是下面的一切应该像一棵树,如下图所示,取自示例并正在独立工作。我只是知道如何将这两个概念结合起来。
你能帮助我吗?
最小示例:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\usetikzlibrary{trees}
\begin{tikzpicture}[scale=0.9,text width=2.7cm, align=flush center,
grow cyclic,
level 1/.style={level distance=2.5cm,sibling angle=90},
level 2/.style={text width=2cm, font=\footnotesize, level distance=3cm,sibling angle=30}]
\node[font=\bfseries] {Computational Complexity} % root
child { node {Computational Problems}
child { node {Problem Measures} } child { node {Problem Aspects} }
child { node {Problem Domains} } child { node {Key Problems} }
}
child { node {Computational Models}
child { node {Turing Machines} } child { node {Random-Access Machines} }
child { node {Circuits} } child { node {Binary Decision Diagrams} }
child { node {Oracle Machines} } child { node {Programming in Logic} }
}
child { node {Measuring Complexity}
child { node {Complexity Measures} } child { node {Classifying Complexity} }
child { node {Comparing Complexity} } child { node {Describing Complexity} }
}
child { node {Solving Problems}
child { node {Exact Algorithms} } child { node {Randomization} }
child { node {Fixed-Parameter Algorithms} } child { node {Parallel Computation} }
child { node {Partial Solutions} } child { node {Approximation} }
};
\end{tikzpicture}
\caption{Mindmap}
\label{test}
\end{figure}
The happy tree works fine but has wrong root ....
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
\tikzset{
basic/.style = {draw, text width=2cm, drop shadow, font=\sffamily, rectangle},
root/.style = {basic, rounded corners=2pt, thin, align=center,
fill=green!30},
level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=green!60,
text width=8em},
level 3/.style = {basic, thin, align=left, fill=pink!60, text width=6.5em}
}
\begin{tikzpicture}[
level 1/.style={sibling distance=40mm},
edge from parent/.style={->,draw},
>=latex]
% root of the the initial tree, level 1
\node[root] {Drawing diagrams}
% The first level, as children of the initial tree
child {node[level 2] (c1) {Defining node and arrow styles}}
child {node[level 2] (c2) {Positioning the nodes}}
child {node[level 2] (c3) {Drawing arrows between nodes}};
% The second level, relatively positioned nodes
\begin{scope}[every node/.style={level 3}]
\node [below of = c1, xshift=15pt] (c11) {Setting shape};
\node [below of = c11] (c12) {Choosing color};
\node [below of = c12] (c13) {Adding shading};
\node [below of = c2, xshift=15pt] (c21) {Using a Matrix};
\node [below of = c21] (c22) {Relatively};
\node [below of = c22] (c23) {Absolutely};
\node [below of = c23] (c24) {Using overlays};
\node [below of = c3, xshift=15pt] (c31) {Default arrows};
\node [below of = c31] (c32) {Arrow library};
\node [below of = c32] (c33) {Resizing tips};
\node [below of = c33] (c34) {Shortening};
\node [below of = c34] (c35) {Bending};
\end{scope}
% lines from each level 1 node to every one of its "children"
\foreach \value in {1,2,3}
\draw[->] (c1.195) |- (c1\value.west);
\foreach \value in {1,...,4}
\draw[->] (c2.195) |- (c2\value.west);
\foreach \value in {1,...,5}
\draw[->] (c3.195) |- (c3\value.west);
\end{tikzpicture}
\end{document}