非树结构点对点 tikz 思维导图

非树结构点对点 tikz 思维导图

所有使用 tikz 创建思维导图的示例均采用树形方法:父节点位于中间,其具有较小的子节点,其具有更小的子节点,等等。

是否可以创建点对点思维导图,即不是树结构,而是在祖先树中同一级别有多个节点的结构。例如:

在此处输入图片描述

其中节点 A、B 和 C 大小相同并且彼此完全连接?

答案1

使用 Tik 即可实现使用mindmaps库。但您必须手动绘制第一级节点之间的连接:

\documentclass[tikz]{standalone}
\usetikzlibrary{mindmap,backgrounds}

\begin{document}

\begin{tikzpicture}[mindmap,concept color=black]

  \node[concept,fill=blue!30] (A) at (0,0) {A}
   child[grow=200] {node[concept,fill=blue!20] (Aa) {a}}
   child[grow=240] {node[concept,fill=blue!20] (Ab) {b}};

  \node[concept,fill=red!30] (B) at (5,5) {B}
   child[grow=20] {node[concept,fill=red!20] (Ba) {a}}
   child[grow=160] {node[concept,fill=red!20] (Bb) {b}};

  \node[concept,fill=green!30] (C) at (10,0) {C}
   child[grow=340] {node[concept,fill=green!20] (Ca) {a}}
   child[grow=300] {node[concept,fill=green!20] (Cb) {b}};

  \path
   (A) to[circle connection bar] (B)
   (B) to[circle connection bar] (C) 
   (A) to[circle connection bar] (C);

\end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

这个论坛上有很多解决方案,例如这里,仅需进行少量修改。

\documentclass[tikz]{standalone}
\usetikzlibrary{mindmap}
\pagestyle{empty}
\begin{document}
\def\colorLeft{green!50!yellow!70!red!30!blue}
\def\colorRight{orange}
\def\colorTop{red!80!blue!80}
\begin{tikzpicture}[small mindmap, outer sep=0pt, text=black]
% from https://tex.stackexchange.com/a/144828/121799
\begin{scope}[concept color=\colorRight]
\node (right) at (-30:3) [concept] {Right}
  [clockwise from=0]
  child { node[concept] {R.1} }
  child { node[concept] {R.2} }
;
\end{scope}

\begin{scope}[concept color=\colorLeft]
\node (left) at (210:3) [concept] {Left}
  [counterclockwise from=180]
  child { node[concept] {L.1}  }
  child { node[concept] {L.2} }
;
\end{scope}

\begin{scope}[concept color=\colorTop]
\node (top) at (90:3) [concept] {Top}
  [counterclockwise from=53]
  child { node[concept] {T.1}  }
  child { node[concept] {T.2} }
;
\end{scope}


\path (left) to[circle connection bar switch color=from (\colorLeft) to (\colorRight)] (right) ;
\path (left) to[circle connection bar switch color=from (\colorLeft) to (\colorTop)] (top) ;
\path (top) to[circle connection bar switch color=from (\colorTop) to (\colorRight)] (right) ;


\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容