![连接 MindMap 节点时的颜色转换](https://linux22.com/image/354941/%E8%BF%9E%E6%8E%A5%20MindMap%20%E8%8A%82%E7%82%B9%E6%97%B6%E7%9A%84%E9%A2%9C%E8%89%B2%E8%BD%AC%E6%8D%A2.png)
如何修复连接节点的额外边的颜色以实现平滑过渡?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{mindmap,backgrounds}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[mindmap, grow cyclic, every node/.style=concept, concept color=orange!40,
level 1/.append style={level distance=5cm,sibling angle=90},
level 2/.append style={level distance=3cm,sibling angle=45}]
\node{Root}
child [concept color=blue!30] { node (a) {Child A}
child { node (aa) {Child AA}}
child { node (ab) {Child AB}}
}
child [concept color=yellow!30] { node {Child B}
child { node (ba) {Child BA}}
child { node (bb) {Child BB}}
child { node (bc) {Child BC}}
child { node (bd) {Child BD}}
}
child [concept color=teal!40, grow=20] { node (c) {Child C}
child { node (ca) {Child CA}}
}
child [concept color=purple!50] { node (d) {Child D}
child [concept color=green!40] { node (da) {DA}}
child [concept color=green!40] { node (db) {DB}}
};
\begin{pgfonlayer}{background}
\draw [circle connection bar]
(aa) edge (db)
(da) edge (ca)
(c) edge (bc)
(a) edge (ba) edge (da) edge (ca)
(d) edge (bd);
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
答案1
您可以指定从一种颜色切换到另一种颜色。例如,
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap,backgrounds}
\begin{document}
\begin{tikzpicture}[mindmap, grow cyclic, every node/.style=concept, concept color=orange!40,
level 1/.append style={level distance=5cm,sibling angle=90},
level 2/.append style={level distance=3cm,sibling angle=45}]
\node{Root}
child [concept color=blue!30] { node (a) {Child A}
child { node (aa) {Child AA}}
child { node (ab) {Child AB}}
}
child [concept color=yellow!30] { node {Child B}
child { node (ba) {Child BA}}
child { node (bb) {Child BB}}
child { node (bc) {Child BC}}
child { node (bd) {Child BD}}
}
child [concept color=teal!40, grow=20] { node (c) {Child C}
child { node (ca) {Child CA}}
}
child [concept color=purple!50] { node (d) {Child D}
child [concept color=green!40] { node (da) {DA}}
child [concept color=green!40] { node (db) {DB}}
};
\begin{scope}[on background layer]
\foreach \i/\j/\k/\l in
{%
aa/blue!30/db/green!40,
da/green!40/ca/teal!40,
c/teal!40/bc/yellow!30,
a/blue!30/ba/yellow!30,
a/blue!30/da/green!40,
a/blue!30/ca/teal!40,
d/purple!50/bd/yellow!50%
}
\path (\i) to[circle connection bar switch color=from (\j) to (\l)] (\k);
\end{scope}
\end{tikzpicture}
\end{document}