3

I am beginning to work with mind maps using the mindmap library of TikZ. What I want is to place an annotation in the middle point of the bar connecting two nodes. The MWE below puts an annotation in the middle point of two nodes (using the calc package), which does not coincide with the middle point of the connection bar for nodes of different size (as in this case).

MWE:

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\usetikzlibrary{mindmap}

\begin{document}
\begin{tikzpicture}[mindmap,concept color=red!50]
\node [concept] (root) {Root concept} child[clockwise from=30] {node[concept] (child) {Child concept}};
\node[annotation,fill=black!40,above,align=center,text width=0.5cm,rotate=30] at ($(root.center)!0.5!(child.center)$) {text};
\end{tikzpicture}
\end{document}

which results in:

MWE

I am sure one can access the exact coordinate of the middle point of the connection bar, but have not found how (knowing the radius of each node would indeed help, is this possible?).

Any help will be much appreciated. Thank you very much in advance.

1

Make a path from one node to the other, and place the node midway on that, then the edges of the nodes are used. Adding sloped instead of rotate=<angle> and the node is automatically rotated.

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\usetikzlibrary{mindmap}

\begin{document}
\begin{tikzpicture}[mindmap,concept color=red!50]
\node [concept] (root) {Root concept} child[clockwise from=30] {node[concept] (child) {Child concept}};
\path (root) -- node[annotation,fill=black!40,above,align=center,text width=0.5cm,sloped] {text} (child);
\end{tikzpicture}
\end{document}

enter image description here

|improve this answer|||||

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.