如下图所示,Jupiter、PA2AM、VPC三个节点底部没有对齐,如何才能对齐好呢?
\documentclass[tikz]{standalone}
\usetikzlibrary{mindmap, positioning}
\begin{document}
\begin{tikzpicture}[
root concept/.append style = {concept color = teal!30, sibling angle = 90, font = \LARGE, minimum size = 0pt},
level 1 concept/.append style = {concept color = teal!30, sibling angle = 90, font = \large},
level 2 concept/.append style = {concept color = teal!30, sibling angle = 60, font = \large},
]
\path[mindmap]
node (spec) [concept, red] {\textsl{Specification}}
[counterclockwise from = 225]
child[purple] {
node[concept] {\textsl{Imple-\\mentation}}
[counterclockwise from = 240]
child { node (cjupiter) [concept, font = \large] {Jupiter} }
child { node (pa2am) [concept, font = \large] {PA2AM} }
}
child[violet] {
node (veri) [concept] {\textsl{Veri-\\fication}}
[clockwise from = -90]
child { node (vpc) [concept, font = \large] {VPC} }
};
\end{tikzpicture}
\end{document}
答案1
当然它们不是对齐的:左边两个节点排列成一个圆圈,而右边的节点向下。所有三个子节点都与其父节点共享相同的半径。所以很明显,解决方案是level distance
为这三个子节点指定。
这里,我使用level distance=3cm
表示左边两个子节点,level distance=2.598cm
使用 表示右边一个子节点。这是基本的三角函数:
3cm * cos( -90 - 240 ) = 3cm * 0.866 = 2.598cm
建议(与您的问题无关):请不要使用手动换行符-\\
。\-
而是使用 来告诉 TeX 连字点在哪里。
\documentclass[tikz]{standalone}
\usetikzlibrary{mindmap, positioning}
\begin{document}
\begin{tikzpicture}[
root concept/.append style = {concept color = teal!30, sibling angle = 90, font = \LARGE, minimum size = 0pt},
level 1 concept/.append style = {concept color = teal!30, sibling angle = 90, font = \large},
level 2 concept/.append style = {concept color = teal!30, sibling angle = 60, font = \large},
]
\path[mindmap]
node (spec) [concept] {\textsl{\color{red}Specification}}
[counterclockwise from = 225]
child[purple] {
node[concept] {\textsl{Imple\-mentation}}
[counterclockwise from = 240]
child[level distance=3cm] { node (cjupiter) [concept, font = \large] {Jupiter} }
child[level distance=3cm] { node (pa2am) [concept, font = \large] {PA2AM} }
}
child[violet] {
node (veri) [concept] {\textsl{Veri\-fication}}
[clockwise from = -90]
child[level distance=2.598cm] { node (vpc) [concept, font = \large] {VPC} }
};
\end{tikzpicture}
\end{document}