![思维导图级别特定子距离](https://linux22.com/image/270431/%E6%80%9D%E7%BB%B4%E5%AF%BC%E5%9B%BE%E7%BA%A7%E5%88%AB%E7%89%B9%E5%AE%9A%E5%AD%90%E8%B7%9D%E7%A6%BB.png)
使用我得到的答案这个问题,我有一个思维导图,里面有 6 个子项,每个子项又有 2-5 个自己的子项。
梅威瑟:
% Author: Till Tantau
% Source: The PGF/TikZ manual
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{mindmap,trees}
\begin{document}
\resizebox{!}{4 in}{%
\begin{tikzpicture}
\path[
mindmap,
concept color=black,
text=white,
grow cyclic,
segment length=20cm
]
node[concept] {Main}
[clockwise from=0]
child[concept color=green!50!black] {%
node[concept] {A}
[clockwise from=65]
child {node[concept] {A1} }
child {node[concept] {A2} }
child {node[concept] {A3} }
}
child[concept color=blue] {%
node[concept] {B}
[clockwise from=-20]
child {node[concept] {B2} }
child {node[concept] {B3} }
}
child[concept color=red] {%
node[concept] {C}
[clockwise from=5]
child {node[concept] {C1} }
child {node[concept] {C2} }
child {node[concept] {C3} }
child {node[concept] {C4} }
child {node[concept] {C5} }
}
child[concept color=orange] {%
node[concept] {D}
[clockwise from=-145]
child {node[concept] {D1} }
child {node[concept] {D2} }
}
child[concept color=magenta] {%
node[concept] {E}
[clockwise from=-180]
child {node[concept] {E1} }
child {node[concept] {E2} }
child {node[concept] {E3} }
}
child[concept color=brown] {%
node[concept] {F}
[clockwise from=-245]
child {node[concept] {F1} }
child {node[concept] {F2} }
child {node[concept] {F3} }
child {node[concept] {F4} }
};
\end{tikzpicture}
}
\end{document}
输出:
问题:
我需要 1 级子节点 ( A
- F
) 离父节点 () 更远一些,MAIN
因为即使现在,也F
离 太近A
并且F3
与 重叠A1
。此外,如果我希望每个 1 级子节点都有 5 或 6 个自己的子节点,那么就会出现严重的重叠。我该如何增加每个子节点/节点或至少每个级别的兄弟节点距离。
答案1
您可以在里面使用level distance=<length>
和/或来自定义特定级别的距离和角度。完整示例:sibling angle=<value>
level <number>/.append style
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{mindmap,trees}
\begin{document}
\resizebox{!}{4 in}{%
\begin{tikzpicture}
\path[
mindmap,
concept color=black,
text=white,
grow cyclic,
segment length=20cm,
level 1/.append style={level distance=8cm,sibling angle=60},
level 2/.append style={level distance=2.5cm},
]
node[concept] {Main}
[clockwise from=0]
child[concept color=green!50!black] {%
node[concept] {A}
[clockwise from=30]
child {node[concept] {A1} }
child {node[concept] {A2} }
child {node[concept] {A3} }
child {node[concept] {A4} }
child {node[concept] {A5} }
child {node[concept] {A6} }
}
child[concept color=blue] {%
node[concept] {B}
[clockwise from=30]
child {node[concept] {B1} }
child {node[concept] {B2} }
child {node[concept] {B3} }
child {node[concept] {B4} }
child {node[concept] {B5} }
child {node[concept] {B6} }
}
child[concept color=red] {%
node[concept] {C}
[clockwise from=30]
child {node[concept] {C1} }
child {node[concept] {C2} }
child {node[concept] {C3} }
child {node[concept] {C4} }
child {node[concept] {C5} }
child {node[concept] {C6} }
}
child[concept color=orange] {%
node[concept] {D}
[clockwise from=30]
child {node[concept] {D1} }
child {node[concept] {D2} }
child {node[concept] {D3} }
child {node[concept] {D4} }
child {node[concept] {D5} }
child {node[concept] {D6} }
}
child[concept color=magenta] {%
node[concept] {E}
[clockwise from=30]
child {node[concept] {E1} }
child {node[concept] {E2} }
child {node[concept] {E3} }
child {node[concept] {E4} }
child {node[concept] {E5} }
child {node[concept] {E6} }
}
child[concept color=brown] {%
node[concept] {F}
[clockwise from=30]
child {node[concept] {F1} }
child {node[concept] {F2} }
child {node[concept] {F3} }
child {node[concept] {F4} }
child {node[concept] {F5} }
child {node[concept] {F6} }
};
\end{tikzpicture}
}
\end{document}