连接 MindMap 节点时的颜色转换

连接 MindMap 节点时的颜色转换

如何修复连接节点的额外边的颜色以实现平滑过渡?

在此处输入图片描述

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

颜色过渡

相关内容