我正在尝试用 TikZ 绘制思维导图。
绘制概念连接时,有些连接会遮住节点本身。有没有直接的方法强制将连接置于背景上?
梅威瑟:
\begin{tikzpicture}[mindmap,
level 1 concept/.append style={sibling angle=150},
extra concept/.append style={color=blue!50,text=black}]
\begin{scope}[mindmap, concept color=red!80, text=white]
\node [concept] (root) at (0,0) {root}[clockwise from=0]
child[concept]
{node [concept] (node-a) {A}
}
child[concept]
{node [concept] (node-b) {B}
}
;
\end{scope}
\draw [concept connection]
(node-a) edge (node-b)
;
\end{tikzpicture}
答案1
将库添加backgrounds
到您的库中tikzlibrary
,然后将连接括在以下标签中:
\begin{pgfonlayer}{background} <connections> \end{pgfonlayer}
输出
代码
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap,backgrounds}
\begin{document}
\begin{tikzpicture}[mindmap,
level 1 concept/.append style={sibling angle=150},
extra concept/.append style={color=blue!50,text=black}]
\begin{scope}[mindmap, concept color=red!80, text=white]
\node [concept] (root) at (0,0) {root}[clockwise from=0]
child[concept]
{node [concept] (node-a) {A}
}
child[concept]
{node [concept] (node-b) {B}
}
;
\end{scope}
\begin{pgfonlayer}{background}
\draw [concept connection]
(node-a) edge (node-b)
;
\end{pgfonlayer}
\end{tikzpicture}
\end{document}