2

I'm trying to draw a mindmap with TikZ.

When drawing the concept connections, some of them cover the nodes themselves. Is there a direct way to force the connections to be on the background?

MWE:

\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

Add the backgrounds library to your tikzlibrary and then enclose the connections in these tags:

\begin{pgfonlayer}{background} <connections> \end{pgfonlayer}

Output

figure 1

Code

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.