思维导图,获得规则/和谐圆形的通用方法,适用于 3 级及以上级别

思维导图,获得规则/和谐圆形的通用方法,适用于 3 级及以上级别

更新 感谢薛定谔的猫的最新更新,我现在可以相当轻松地制作以下类型的 3 个级别的常规思维导图。

圆形常规思维导图

我们几乎已经实现了常规圆形思维导图的全自动组织。可能的改进是,通过重复使用 每个级别的节点数 (+幻影节点) 计数器,暗示(而不是手动输入)sibling angles第 1、2 和 3 级。\tikzcountchildi

答案的演变

基于 思维导图-growcyclic-from 和这个答案如何将 2 级概念思维导图节点放在矩形旁边那么,我们如何才能得到第 2 级和第 3 级节点的圆路径结果呢?

根据薛定谔猫的回答,的发展有一个技巧\tikzcountgrandchildsibling angles但我仍在努力寻找解决方案。

在此处输入图片描述

\documentclass[tikz,border=9]{standalone}
\usetikzlibrary{mindmap,decorations}
\usepackage{xspace}

\makeatletter
\newcount\tikzcountgrandchild
\def\tikz@grow@concentric{%
  \pgftransformreset%
  \pgftransformshift{\pgfpoint{\pgfkeysvalueof{/tikz/overall xshift}}{\pgfkeysvalueof{/tikz/overall yshift}}}% 
  \pgftransformrotate{\pgfkeysvalueof{/tikz/overall rotation}+(\pgfkeysvalueof{/tikz/sibling angle})*(\tikzcountgrandchild)}%
  \ifnum\tikztreelevel=1
    \pgftransformrotate{(\pgfkeysvalueof{/tikz/sibling angle})*(\pgfkeysvalueof{/tikz/noc}-1)/2}%
  \fi
  \pgftransformxshift{\the\tikzleveldistance}%
  \ifnum\tikztreelevel=2
    \global\advance\tikzcountgrandchild by1
 \fi
%  \ifnum\tikztreelevel=3
%    \global\advance\tikzcountgrandchild by1
% \fi
}

\begin{document}
\tikzset{overall rotation/.initial=0,
    overall xshift/.initial=0pt,
    overall yshift/.initial=0pt,
    Xshift/.style={xshift=#1,overall xshift=#1},
    Yshift/.style={yshift=#1,overall yshift=#1},
    noc/.initial=0,
    branch color/.style={
        concept color=#1!white,
        every child/.append style={concept color=#1!white!30!white},
    }
}

\begin{tikzpicture}
    \begin{scope}[text width=1.5cm,align=flush center,
            mindmap,growth function=\tikz@grow@concentric,
            overall rotation=-45,
            sibling angle=360/30,
            nodes={concept},
            concept color=green!70!black,
            root concept/.append style={ ball color=green!50, line width=1.5ex,text=green!40!black,font=\huge\bfseries\scshape,minimum size=4.5cm,text width=4.5cm,},                   
            level 1/.style={,level distance=8cm,font=\Large,minimum size=3.0cm,text width=2.5cm,},
            level 2/.style={level distance=12cm,font=\large,minimum size=2.0cm,text width=2.0cm},
            level 3/.style={level distance=15cm,font=\large,minimum size=2.0cm,text width=2.0cm}
        ]
        \node [root concept]{Clients} 
        child[noc=3,branch color=green!70]{node {Retail} 
            child[] {node {CGPI}} 
            child[] {node {Banques priv\'ees}} 
            child[] {node {Retail banking}} 
        }
        child[noc=3,branch color=green!70]{node {ALM} 
            child { node (equity) {Equity}
                child { node {Indices}}
                child { node {Stocks}}
                child { node {ETFs}}
            }
            child { node (commo) {Commodities}
                child { node {Soft commo}}
                child { node {Precious}}        
                child { node {Oil/Gas}}
            }
            child[] {node {Assurances}} 
            child[] {node {Caisse de retraite}}         
        } 
        child[noc=1,branch color=green!80]{node {Directions financi\'eres} 
            child[] {node {Corporate}} 
        } 
        child[noc=3,branch color=green!70]{node {Instrument specialists} 
            child {node {Asset Managers traditionnels}} 
            child {node {Hedge funds}} 
            child {node {Trading desks form other banks}} 
        } 
        ;
    \end{scope}

    \begin{scope}[Xshift=-5cm,text width=1.5cm,align=flush center,
            mindmap,growth function=\tikz@grow@concentric,
            overall rotation=45,
            sibling angle=360/30,
            nodes={concept},
            concept color=yellow!70!black,
            root concept/.append style={ ball color=yellow!50, line width=1.5ex,text=yellow!40!black,font=\huge\bfseries\scshape,minimum size=4.5cm,text width=4.5cm,},                   
            level 1/.style={,level distance=8cm,font=\Large,minimum size=3.0cm,text width=2.5cm,},
            level 2/.style={level distance=12cm,font=\large,minimum size=2.0cm,text width=2.0cm}
        ]
        \node [root concept]{Suppliers} 
        child[noc=3,branch color=yellow!70]{node {Retail} 
            child[] {node {CGPI}} 
            child[] {node {Banques priv\'ees}} 
            child[] {node {Retail banking}} 
        }
        child[noc=3,branch color=yellow!70]{node {ALM} 
            child[] {node {Mutuelles}} 
            child[] {node {Assurances}} 
            child[] {node {Caisse de retraite}}         
        } 
        child[noc=1,branch color=yellow!80]{node {Directions financi\'eres} 
            child[] {node {Corporate}} 
        } 
        child[noc=3,branch color=yellow!70]{node {Instrument specialists} 
            child {node {Asset Managers traditionnels}} 
            child {node {Hedge funds}} 
            child {node {Trading desks form other banks}} 
        } 
        ;
    \end{scope}

\end{tikzpicture}
\end{document}

一旦有了 1、2 和 3 级的计数器,我们能否仅仅“暗示”节点角度从 3 级,然后是 2 级和 1 级?例如,在下面的绿色地图上。

在此处输入图片描述

我们有 15 个 3 级节点、11 个 2 级节点、4 个 1 级节点,

就描述每个节点的坐标(使用计数器)而言,我们有:

(1 1 0) 1 node level 2
(1 2 0) 1 node level 2
(1 3 0) 1 node level 2      1 node level 1
(2 1 0) 1 node level 2
(2 2 0) 1 node level 2
(2 3 1) 1 node level 2
(2 3 2)
(2 3 3)
(2 4 1) 1 node level 2
(2 4 2)
(2 4 3)                     1 node level 1
(3 1 0) 1 node level 2      1 node level 1
(4 1 0) 1 node level 2
(4 2 0) 1 node level 2
(4 3 0) 1 node level 2      1 node level 1

我们有

level 3 by counting the numer of (x,y,z)that are distinct (#rows of the table)
level 2 by counting the numer of (x,y) that are distinct
level 1 by counting the numer of (x) that are distinct

如果我们想要小地图描述一个圆的某个部分,我们能不能从上面表格的计数中自动得到

angle @ level3 is set to  (portion * 360/14) (and not 15)
angle @ level2 is set to  (portion * 360/10) (and not 11)
angle @ level1 is set to  (portion * 360/3) (and not 4)

在下面的速写中,我们希望最终的迷你地图呈四分之一圆形(不失一般性)。第 2 级的节点(第 3 级没有实际节点)实际上会为第 3 级所需的节点(未填充的节点)计数。 快速草图

答案1

更新答案针对您编辑的问题。只需为各个级别定义一些计数并引入一些偏移角度即可。(更一般地,可能需要添加一些与级别相关的附加角度,或者做一个自动化版本,最低的代码将在某个时候变成这个版本。)对于您当前的示例,这似乎已经足够了。

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{mindmap}
\makeatletter
\newif\ifmmap@debug
\mmap@debugfalse
\newcommand{\mmap@debug@message}[1]{\ifmmap@debug
\typeout{#1}%
\fi}
\newcount\tikzcountchildi
\newcount\tikzcountchildii
\newcount\tikzcountchildiii
\newcount\tikzcountchildiv
\newcount\tikzcountchildv
\tikzcountchildi=0
\tikzcountchildii=0
\tikzcountchildiii=0
\tikzcountchildiv=0
\tikzcountchildv=0
\tikzset{Julien growth/.style={growth function=\tikz@grow@Julien,
mmap/initialize counts},
mmap/.cd,initialize counts/.code={\global\tikzcountchildi=0%
\global\tikzcountchildii=0%
\global\tikzcountchildiii=0%
\global\tikzcountchildiv=0%
\global\tikzcountchildv=0%
}
}



\def\tikz@grow@Julien{%
  \pgftransformreset% 
  \pgftransformshift{\pgfpoint{\pgfkeysvalueof{/tikz/mmap/overall xshift}}%
        {\pgfkeysvalueof{/tikz/mmap/overall yshift}}}%
  \ifcase\tikztreelevel 
  \or
    \pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
        +\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
        +\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildi}%
    \global\advance\tikzcountchildi by1\relax%
  \or
    \pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
        +\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
        +\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildii}%
    \global\advance\tikzcountchildii by1\relax%
  \or
    \pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
        +\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
        +\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildiii}%
    \global\advance\tikzcountchildiii by1\relax%
  \or
    \pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
        +\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
        +\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildiv}%
    \global\advance\tikzcountchildiv by1\relax%
  \or
    \pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
        +\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
        +\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildv}%
    \global\advance\tikzcountchildv by1\relax%
  \fi
  \mmap@debug@message{level=\the\tikztreelevel,%
  \the\tikzcountchildi,\the\tikzcountchildii,\the\tikzcountchildiii,
  rotation=\pgfutil@tempb,sibling angle=\pgfkeysvalueof{/tikz/sibling angle}}%
  \pgftransformrotate{\pgfutil@tempb}%
  \pgftransformxshift{\the\tikzleveldistance}%
}
\makeatother
\begin{document}
\tikzset{mmap/.cd,overall rotation/.initial=0,% overall transformation of mind maps
    overall xshift/.initial=0pt,
    overall yshift/.initial=0pt,
    sign/.initial=1,% 1=clockwise,-1=counterclockwise
    /tikz/.cd,offset angle/.initial=0,
    Xshift/.style={xshift=#1,mmap/overall xshift=#1},
    Yshift/.style={yshift=#1,mmap/overall yshift=#1},
    branch color/.style={
        concept color=#1!white,
        every child/.append style={concept color=#1!white!30!white},
    }
}

\begin{tikzpicture}[node font=\sffamily]
    \begin{scope}[text width=1.5cm,align=flush center,
            mindmap,Julien growth,
            mmap/overall rotation=110,mmap/sign=-1,
            nodes={concept},
            concept color=green!70!black,
            root concept/.append style={ball color=green!50, line width=1.5ex,text=green!40!black,font=\huge\bfseries\scshape,minimum size=4.5cm,text width=4.5cm,},                   
            level 1/.style={level distance=5cm,font=\Large,minimum size=3.0cm,
                text width=2.5cm,sibling angle=65},
            level 2/.style={level distance=9cm,
                font=\large,minimum size=2.0cm,text width=2.0cm,
                    sibling angle=22},
            level 3/.style={level distance=12cm,font=\large,minimum
            size=2.0cm,text width=2.0cm,sibling angle=12,
            offset angle=50},
        ]
        \node [root concept]{Clients} 
        child[branch color=green!70]{node {Retail} 
            child[] {node {CGPI}} 
            child[] {node {Banques priv\'ees}} 
            child[] {node {Retail banking}} 
        }
        child[branch color=green!70]{node {ALM} 
            child { node (equity) {Equity}
                child { node {Indices}}
                child { node {Stocks}}
                child { node {ETFs}}
            }
            child { node (commo) {Commo--\\dities}
                child { node {Soft commo}}
                child { node {Precious}}        
                child { node {Oil/Gas}}
            }
            child[] {node {Assurances}} 
            child[] {node {Caisse de retraite}}         
        } 
        child[branch color=green!80]{node {Directions financi\'eres} 
            child[] {node {Corporate}} 
        } 
        child[branch color=green!70]{node {Instrument specialists} 
            child {node {Asset Managers traditionnels}} 
            child {node {Hedge funds}} 
            child {node {Trading desks form other banks}} 
        } 
        ;
    \end{scope}

    \begin{scope}[Xshift=-12cm,text width=1.5cm,align=flush center,
            mindmap,Julien growth,
            mmap/overall rotation=290,mmap/sign=-1,
            nodes={concept},
            concept color=yellow!70!black,
            root concept/.append style={ ball color=yellow!50, line width=1.5ex,text=yellow!40!black,font=\huge\bfseries\scshape,minimum size=4.5cm,text width=4.5cm,},                   
            level 1/.style={level distance=5cm,font=\Large,minimum size=3.0cm,text width=2.5cm,
                sibling angle=60},
            level 2/.style={level distance=9cm,font=\large,minimum
                size=2.0cm,text width=2.0cm,sibling angle=24},
        ]
        \node [root concept]{Suppliers} 
        child[branch color=yellow!70]{node {Retail} 
            child[] {node {CGPI}} 
            child[] {node {Banques priv\'ees}} 
            child[] {node {Retail banking}} 
        }
        child[branch color=yellow!70]{node {ALM} 
            child[] {node {Mutuelles}} 
            child[] {node {Assurances}} 
            child[] {node {Caisse de retraite}}         
        } 
        child[branch color=yellow!80]{node {Directions financi\'eres} 
            child[] {node {Corporate}} 
        } 
        child[branch color=yellow!70]{node {Instrument specialists} 
            child {node {Asset Managers traditionnels}} 
            child {node {Hedge funds}} 
            child {node {Trading desks form other banks}} 
        } 
        ;
    \end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

旧答案:这是一些辅助文件黑客行为。最低的代码可能对编写上述代码的自动化版本有用。

这段代码并不是一个太严肃的答案。所以,是的,人们可以将内容写入辅助文件并在需要时恢复它。但我绝对不会声称这是一个通用的代码。可能人们必须选择不同的参数。为了拥有多个思维导图,人们需要给一个garlic growth唯一的 id(例如AB)。(我不喜欢洋葱,所以我把这个叫做大蒜。)人们必须编译几次。

\documentclass[tikz,border=9]{standalone}
\usetikzlibrary{mindmap,decorations}
\usepackage{xspace}
\makeatletter
\newcount\tikzcountchildi
\newcount\tikzcountchildii
\newcount\tikzcountchildiii
\tikzcountchildi=0
\tikzcountchildii=0
\tikzcountchildiii=0
\tikzset{garlic growth/.style={growth function=\tikz@grow@garlic,
/tikz/mmap/name=#1,mmap/#1/.is family,
mmap/initialize counts},
mmap/.cd,initialize counts/.code={\tikzcountchildi=0%
\tikzcountchildii=0%
\tikzcountchildiii=0%
}
}
\def\tikz@mmap@store@aux#1#2{%
\immediate\write\@mainaux{\string\expandafter\xdef\noexpand\csname pgfk@/tikz/mmap/\pgfkeysvalueof{/tikz/mmap/name}/#1\string\endcsname{#2}}}%
\def\tikz@mmap@get@from@aux#1#2{%
\ifcsname pgfk@/tikz/mmap/\pgfkeysvalueof{/tikz/mmap/name}/#1\endcsname
\edef#2{\csname pgfk@/tikz/mmap/\pgfkeysvalueof{/tikz/mmap/name}/#1\endcsname}%
\else
\edef#2{0}%
\fi
}

\newcount\tikzcountgrandchild
\def\tikz@grow@garlic{%
  \ifcase\tikztreelevel 
  \or
    \global\advance\tikzcountchildi by1\relax%
    \ifnum\tikznumberofcurrentchild=1\relax
     \tikz@mmap@store@aux{n}{\the\tikznumberofchildren}%
     \tikz@mmap@store@aux{l-1}{\the\tikzleveldistance}%
    \fi
    \tikzcountchildii=0\relax
  \or
    \global\advance\tikzcountchildii by1\relax%
    \ifnum\tikzcountchildii=1\relax
     \ifnum\tikznumberofcurrentchild=1\relax
      \tikz@mmap@store@aux{l-2}{\the\tikzleveldistance}%
     \fi
    \fi
    \ifnum\tikznumberofcurrentchild=1\relax
     \tikz@mmap@store@aux{n-\the\tikzcountchildi}{\the\tikznumberofchildren}%
     \c@pgf@counta=0\relax% loop counter
     \edef\pgfutil@tempb{0}% angle space needed for this child
     \tikz@mmap@get@from@aux{s-\the\tikzcountchildi}{\pgfutil@tempf}%    
     \pgfmathsetmacro{\pgfutil@tempf}{-\pgfutil@tempf/2}% offset
     \edef\pgfutil@tempe{0}% local rotation angle of grandchild
     \edef\pgfutil@tempg{0}% last angle space needed for grandchild
     % if there were no grandgrand children we only needed to count the children
     \pgfutil@loop
      \ifnum\c@pgf@counta<\tikznumberofchildren
       \advance\c@pgf@counta by1\relax
       \tikz@mmap@get@from@aux{n-\the\tikzcountchildi-\the\c@pgf@counta}{\pgfutil@tempa}%
        \ifnum\pgfutil@tempa=0\relax
         %\typeout{level \the\tikzcountchildi-\the\c@pgf@counta :found 0 children}
         \pgfmathsetmacro{\pgfutil@tempg}{\pgfkeysvalueof{/tikz/mmap/angle 2}}%
        \else
         %\typeout{level \the\tikzcountchildi-\the\c@pgf@counta :found \pgfutil@tempa\space children}
         \pgfmathsetmacro{\pgfutil@tempg}{max(\pgfkeysvalueof{/tikz/mmap/angle 2},%
         \pgfutil@tempa*\pgfkeysvalueof{/tikz/mmap/angle 3})}%
        \fi
        \pgfmathsetmacro{\pgfutil@tempe}{\pgfutil@tempf+\pgfutil@tempb+\pgfutil@tempg/2}%
        \tikz@mmap@store@aux{t-\the\tikzcountchildi-\the\c@pgf@counta}{\pgfutil@tempe}%
        \pgfmathsetmacro{\pgfutil@tempb}{\pgfutil@tempb+\pgfutil@tempg}%        
      \pgfutil@repeat
      %\typeout{n_1=\the\tikzcountchildi : space needed=\pgfutil@tempb}%
      \tikz@mmap@store@aux{s-\the\tikzcountchildi}{\pgfutil@tempb}%
      \ifnum\tikzcountchildi=1
       \tikz@mmap@store@aux{t-\the\tikzcountchildi}{\pgfutil@tempb/2}%
      \else
       \tikz@mmap@get@from@aux{s-\the\numexpr\tikzcountchildi-1}{\pgfutil@tempc}%
       \tikz@mmap@get@from@aux{t-\the\numexpr\tikzcountchildi-1}{\pgfutil@tempd}%
       \pgfmathsetmacro{\pgfutil@tempa}{\pgfutil@tempd+\pgfutil@tempc/2+\pgfutil@tempb/2}%
       \tikz@mmap@store@aux{t-\the\tikzcountchildi}{\pgfutil@tempa}%
      \fi 
    \fi
    %\typeout{level \the\tikzcountchildi-\the\tikzcountchildii:
    %\the\tikznumberofcurrentchild/\the\tikznumberofchildren}
    \pgfmathsetmacro{\pgfutil@tempg}{\tikznumberofchildren*\pgfkeysvalueof{/tikz/mmap/angle 2}}%
    \tikz@mmap@store@aux{s-\the\tikzcountchildi-\the\tikzcountchildii}{\pgfutil@tempg}%     
    \tikzcountchildiii=0\relax
  \or
    \global\advance\tikzcountchildiii by1\relax%
    \ifnum\tikznumberofcurrentchild=1\relax
     \tikz@mmap@store@aux{n-\the\tikzcountchildi-\the\tikzcountchildii}{\the\tikznumberofchildren}%
    \fi 
    \pgfmathsetmacro{\pgfutil@tempa}{(\tikznumberofcurrentchild-\tikznumberofchildren/2-1/2)*%
        (\pgfkeysvalueof{/tikz/sibling angle})}
    \tikz@mmap@store@aux{t-\the\tikzcountchildi-\the\tikzcountchildii-\the\tikzcountchildiii}{\pgfutil@tempa}%
  \fi
  \pgftransformreset% 
  \pgftransformshift{\pgfpoint{\pgfkeysvalueof{/tikz/mmap/overall xshift}}%
        {\pgfkeysvalueof{/tikz/mmap/overall yshift}}}%
  \tikz@mmap@get@from@aux{t-\the\tikzcountchildi}{\pgfutil@tempa}%
  \pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfutil@tempa}%
  \pgftransformrotate{\pgfutil@tempb}%
  \tikz@mmap@get@from@aux{l-1}{\pgfutil@tempc}%
  \pgftransformxshift{\pgfutil@tempc}%
  \ifnum\tikztreelevel=1
    %\typeout{t-\the\tikzcountchildi: rotate by \pgfutil@tempb (t=\pgfutil@tempa)}
  \else
    \tikz@mmap@get@from@aux{t-\the\tikzcountchildi-\the\tikzcountchildii}{\pgfutil@tempa}%
    \pgftransformrotate{\pgfutil@tempa}%
    \tikz@mmap@get@from@aux{l-2}{\pgfutil@tempc}%
    \pgftransformxshift{\pgfutil@tempc}%
    %\typeout{level 2 rotation by \pgfutil@tempa\space and shift by \pgfutil@tempc}
    \ifnum\tikztreelevel=2
    \else
     \tikz@mmap@get@from@aux{t-\the\tikzcountchildi-\the\tikzcountchildii-\the\tikzcountchildiii}{\pgfutil@tempa}%
     \pgftransformrotate{\pgfutil@tempa}%
     \pgftransformxshift{\the\tikzleveldistance}%
    \fi
  \fi
}
\makeatother
\begin{document}
\tikzset{mmap/.cd,
    name/.initial=undef,
    overall rotation/.initial=0,
    overall xshift/.initial=0pt,
    overall yshift/.initial=0pt,
    angle 1/.initial=5,
    angle 2/.initial=25,
    angle 3/.initial=15,
    sign/.initial=1,
    /tikz/.cd,
    Xshift/.style={xshift=#1,mmap/overall xshift=#1},
    Yshift/.style={yshift=#1,mmap/overall yshift=#1},
    branch color/.style={
        concept color=#1!white,
        every child/.append style={concept color=#1!white!30!white},
    }
}

\begin{tikzpicture}
    \begin{scope}[text width=1.5cm,align=flush center,
            mindmap,garlic growth=A,
            mmap/overall rotation=135,mmap/sign=-1,
            sibling angle=40,
            nodes={concept},
            concept color=green!70!black,
            root concept/.append style={ball color=green!50, line width=1.5ex,text=green!40!black,font=\huge\bfseries\scshape,minimum size=4.5cm,text width=4.5cm,},                   
            level 1/.style={level distance=5cm,font=\Large,minimum size=3.0cm,text width=2.5cm,},
            level 2/.style={level distance=6cm,font=\large,minimum size=2.0cm,text width=2.0cm},
            level 3/.style={level distance=4cm,font=\large,minimum size=2.0cm,text width=2.0cm}
        ]
        \node [root concept]{Clients} 
        child[branch color=green!70]{node {Retail} 
            child[] {node {CGPI}} 
            child[] {node {Banques priv\'ees}} 
            child[] {node {Retail banking}} 
        }
        child[branch color=green!70]{node {ALM} 
            child { node (equity) {Equity}
                child { node {Indices}}
                child { node {Stocks}}
                child { node {ETFs}}
            }
            child { node (commo) {Commodities}
                child { node {Soft commo}}
                child { node {Precious}}        
                child { node {Oil/Gas}}
            }
            child[] {node {Assurances}} 
            child[] {node {Caisse de retraite}}         
        } 
        child[branch color=green!80]{node {Directions financi\'eres} 
            child[] {node {Corporate}} 
        } 
        child[branch color=green!70]{node {Instrument specialists} 
            child {node {Asset Managers traditionnels}} 
            child {node {Hedge funds}} 
            child {node {Trading desks form other banks}} 
        } 
        ;
    \end{scope}

    \begin{scope}[Xshift=-12cm,Yshift=3cm,text width=1.5cm,align=flush center,
            mindmap,garlic growth=B,
            mmap/overall rotation=250,mmap/sign=-1,
            nodes={concept},
            concept color=yellow!70!black,
            root concept/.append style={ ball color=yellow!50, line width=1.5ex,text=yellow!40!black,font=\huge\bfseries\scshape,minimum size=4.5cm,text width=4.5cm,},                   
            level 1/.style={level distance=6cm,font=\Large,minimum size=3.0cm,text width=2.5cm,},
            level 2/.style={level distance=6cm,font=\large,minimum
                size=2.0cm,text width=2.0cm},
            mmap/.cd,
            angle 1=5,angle 2=20,angle 3=5,
        ]
        \node [root concept]{Suppliers} 
        child[branch color=yellow!70]{node {Retail} 
            child[] {node {CGPI}} 
            child[] {node {Banques priv\'ees}} 
            child[] {node {Retail banking}} 
        }
        child[branch color=yellow!70]{node {ALM} 
            child[] {node {Mutuelles}} 
            child[] {node {Assurances}} 
            child[] {node {Caisse de retraite}}         
        } 
        child[branch color=yellow!80]{node {Directions financi\'eres} 
            child[] {node {Corporate}} 
        } 
        child[branch color=yellow!70]{node {Instrument specialists} 
            child {node {Asset Managers traditionnels}} 
            child {node {Hedge funds}} 
            child {node {Trading desks form other banks}} 
        } 
        ;
    \end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

总的来说,我认为将图形绘制算法与思维导图结合起来可能更有意义。一些弹簧布局或其他什么。算法试图找到最优值。

附录:这项工作正在进行中。如果我没有成功,这很有可能,这里有一个结构更好、文档更齐全的代码基础版本。我没有添加任何显式增长函数,但这是比较容易的部分(恕我直言)。它将叶子的数量存储在辅助文件中,并计算m代码中解释的数量。

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{mindmap}
\usepackage[fleqn]{amsmath}
\makeatletter
\newif\ifmmap@debug
\mmap@debugtrue
\newcommand{\mmap@debug@message}[1]{\ifmmap@debug
\typeout{#1}%
\fi}
\newcount\tikzcountchildi
\newcount\tikzcountchildii
\newcount\tikzcountchildiii
\newcount\tikzcountchildiv
\newcount\tikzcountchildv
\tikzcountchildi=0
\tikzcountchildii=0
\tikzcountchildiii=0
\tikzcountchildiv=0
\tikzcountchildv=0
\tikzset{garlic growth/.style={growth function=\tikz@grow@garlic,
/tikz/mmap/name=#1,mmap/#1/.is family,
mmap/initialize counts},
mmap/.cd,initialize counts/.code={\tikzcountchildi=0%
\tikzcountchildii=0%
\tikzcountchildiii=0%
\tikzcountchildiv=0%
\tikzcountchildv=0%
}
}
\def\tikz@mmap@store@aux#1#2{%
\immediate\write\@mainaux{\string\expandafter\xdef\noexpand\csname pgfk@/tikz/mmap/\pgfkeysvalueof{/tikz/mmap/name}/#1\string\endcsname{#2}}}%
\def\tikz@mmap@get@from@aux#1#2{%
\ifcsname pgfk@/tikz/mmap/\pgfkeysvalueof{/tikz/mmap/name}/#1\endcsname
\edef#2{\csname pgfk@/tikz/mmap/\pgfkeysvalueof{/tikz/mmap/name}/#1\endcsname}%
\else
\edef#2{0}%
\fi
}
% m is the effective number of children
\def\tikz@compute@mandn#1{% #1=current level k
     \ifcase#1\relax % build up identifier : -i_1-i_2-...-i_k
     \or
      \edef\pgfutil@tempc{-\the\tikzcountchildi}% 
     \or
      \edef\pgfutil@tempc{-\the\tikzcountchildi-\the\tikzcountchildii}% 
     \or
      \edef\pgfutil@tempc{-\the\tikzcountchildi-\the\tikzcountchildii-\the\tikzcountchildiii}% 
     \or
      \edef\pgfutil@tempc{-\the\tikzcountchildi-\the\tikzcountchildii-\the\tikzcountchildiii-\the\tikzcountchildiv}% 
     \or
      \edef\pgfutil@tempc{-\the\tikzcountchildi-\the\tikzcountchildii-\the\tikzcountchildiii-\the\tikzcountchildiv-\the\tikzcountchildv}% 
     \fi
     % store the number of children of parent leaf (and the level distance)
     \ifnum\tikznumberofcurrentchild=1\relax
      \tikz@mmap@store@aux{l-#1}{\the\tikzleveldistance}%
      \tikz@mmap@store@aux{n\pgfutil@tempc}{\the\tikznumberofchildren}%
     \fi
     \ifnum\tikznumberofchildren=0\relax % no children
      \pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/angle #1}}
     \else 
      % sum over the children 
      \c@pgf@counta=0\relax% loop counter
      \edef\pgfutil@tempb{0}% accumulate angle space m needed for this child
      \pgfutil@loop
       \ifnum\c@pgf@counta<\tikznumberofchildren
        \advance\c@pgf@counta by1\relax
        % read out the m value of child
        \tikz@mmap@get@from@aux{m\pgfutil@tempc-\the\c@pgf@counta}{\pgfutil@tempa}%
        \ifdim\pgfutil@tempa pt=0pt\relax
         \pgfmathsetmacro{\pgfutil@tempa}{\pgfkeysvalueof{/tikz/mmap/angle \the\numexpr#1+1}}%
         \mmap@debug@message{m\pgfutil@tempc-\the\c@pgf@counta=0, so added standard angle \pgfutil@tempa}
        \else
         \pgfmathsetmacro{\pgfutil@tempa}{max(\pgfkeysvalueof{/tikz/mmap/angle \the\numexpr#1+1},\pgfutil@tempa}%
         \mmap@debug@message{m\pgfutil@tempc-\the\c@pgf@counta=\pgfutil@tempa\space found and added}%
        \fi
        \pgfmathsetmacro{\pgfutil@tempb}{\pgfutil@tempb+\pgfutil@tempa}%
       \pgfutil@repeat
      \fi 
      \tikz@mmap@store@aux{m\pgfutil@tempc}{\pgfutil@tempb}%
}

\def\tikz@grow@garlic{%
  \ifcase\tikztreelevel 
  \or
    \global\advance\tikzcountchildi by1\relax%
    \ifnum\tikznumberofcurrentchild=1\relax
     \tikz@mmap@store@aux{n}{\the\tikznumberofchildren}%
     \tikz@mmap@store@aux{l-1}{\the\tikzleveldistance}%
    \fi
    \tikzcountchildii=0\relax
  \or
    \global\advance\tikzcountchildii by1\relax%
    \tikz@compute@mandn1
    \tikzcountchildiii=0\relax
  \or
    \global\advance\tikzcountchildiii by1\relax%
    \tikz@compute@mandn2
    \tikzcountchildiv=0\relax
  \or
    \global\advance\tikzcountchildiv by1\relax%
    \tikz@compute@mandn3
    \tikzcountchildv=0\relax
  \or
    \global\advance\tikzcountchildv by1\relax%
    \tikz@compute@mandn4
  \fi
  \pgftransformreset% 
  \pgftransformshift{\pgfpoint{\pgfkeysvalueof{/tikz/mmap/overall xshift}}%
        {\pgfkeysvalueof{/tikz/mmap/overall yshift}}}%
}
\makeatother
\begin{document}
\tikzset{mmap/.cd,
    name/.initial=undef,
    overall rotation/.initial=0,
    overall xshift/.initial=0pt,
    overall yshift/.initial=0pt,
    angle 1/.initial=20,
    angle 2/.initial=20,
    angle 3/.initial=20,
    angle 4/.initial=20,
    angle 5/.initial=20,
    sign/.initial=1,
    /tikz/.cd,
    Xshift/.style={xshift=#1,mmap/overall xshift=#1},
    Yshift/.style={yshift=#1,mmap/overall yshift=#1},
    branch color/.style={
        concept color=#1!white,
        every child/.append style={concept color=#1!white!30!white},
    }
}

\begin{tikzpicture}
    \begin{scope}[text width=1.5cm,align=flush center,
            mindmap,garlic growth=A,
            mmap/overall rotation=135,mmap/sign=-1,
            sibling angle=33,
            nodes={concept},
            concept color=green!70!black,
            root concept/.append style={ball color=green!50, line width=1.5ex,text=green!40!black,font=\huge\bfseries\scshape,minimum size=4.5cm,text width=4.5cm,},                   
            level 1/.style={level distance=5cm,font=\Large,minimum size=3.0cm,text width=2.5cm,},
            level 2/.style={level distance=6cm,font=\large,minimum size=2.0cm,text width=2.0cm},
            level 3/.style={level distance=4cm,font=\large,minimum
            size=2.0cm,text width=2.0cm},
            mmap/.cd,angle 1=-5,angle 2=25,angle 3=14,          
        ]
        \node [root concept]{Clients} 
        child[branch color=green!70]{node {Retail} 
            child[] {node {CGPI}} 
            child[] {node {Banques priv\'ees}} 
            child[] {node {Retail banking}} 
        }
        child[branch color=green!70]{node {ALM} 
            child { node (equity) {Equity}
                child { node {Indices}}
                child { node {Stocks}}
                child { node {ETFs}}
            }
            child { node (commo) {Commodities}
                child { node {Soft commo}}
                child { node {Precious}}        
                child { node {Oil/Gas}}
            }
            child[] {node {Assurances}} 
            child[] {node {Caisse de retraite}}         
        } 
        child[branch color=green!80]{node {Directions financi\'eres} 
            child[] {node {Corporate}} 
        } 
        child[branch color=green!70]{node {Instrument specialists} 
            child {node {Asset Managers traditionnels}} 
            child {node {Hedge funds}} 
            child {node {Trading desks form other banks}} 
        } 
        ;
    \end{scope}

    \begin{scope}[Xshift=-12cm,Yshift=3cm,text width=1.5cm,align=flush center,
            mindmap,garlic growth=B,
            mmap/overall rotation=250,mmap/sign=-1,
            nodes={concept},
            concept color=yellow!70!black,
            root concept/.append style={ ball color=yellow!50, line width=1.5ex,text=yellow!40!black,font=\huge\bfseries\scshape,minimum size=4.5cm,text width=4.5cm,},                   
            level 1/.style={level distance=6cm,font=\Large,minimum size=3.0cm,text width=2.5cm,},
            level 2/.style={level distance=6cm,font=\large,minimum
                size=2.0cm,text width=2.0cm},
            mmap/.cd,
            angle 1=5,angle 2=20,angle 3=5,
        ]
        \node [root concept]{Suppliers} 
        child[branch color=yellow!70]{node {Retail} 
            child[] {node {CGPI}} 
            child[] {node {Banques priv\'ees}} 
            child[] {node {Retail banking}} 
        }
        child[branch color=yellow!70]{node {ALM} 
            child[] {node {Mutuelles}} 
            child[] {node {Assurances}} 
            child[] {node {Caisse de retraite}}         
        } 
        child[branch color=yellow!80]{node {Directions financi\'eres} 
            child[] {node {Corporate}} 
        } 
        child[branch color=yellow!70]{node {Instrument specialists} 
            child {node {Asset Managers traditionnels}} 
            child {node {Hedge funds}} 
            child {node {Trading desks form other banks}} 
        } 
        ;
    \end{scope}
    \node[anchor=south,text width=14cm] at (current bounding box.north)
    {Let us define an array $m$ recursively as follows. For any \emph{outermost}
    leaf
    \[ 
      m_{i_1i_2\cdots i_k}=\alpha_k\;,
    \]
    where $k$ is the level and $\alpha_k$ is the level--dependent ``standard
    angle''. In the code, 
    \[
     \alpha_k=\texttt{\textbackslash pgfkeysvalueof\{/tikz/mmap/angle $k$\}}\;,
    \]
    i.e.\ the $\alpha_k$ are stored in the keys \texttt{angle $k$} in the
    \texttt{mmap} directory. If the leaf is \emph{not outermost}, $m$ is defined
    as the sum of the $m$--values of the children,
    \[ 
     m_{i_1i_2\cdots i_k}=
     \sum\limits_{j=1}^{n_\mathrm{children}}
     \max \{m_{i_1i_2\cdots i_k-j},\alpha_k\}\;.
    \]
    };
\end{tikzpicture}
\end{document}

在此处输入图片描述

我认为需要明确树应该是什么样子。然后就可以使用存储的叶子计数和m条目来绘制它。

答案2

我已经重写了 grow 函数。现在您必须指定nold,即叶子后代的数量。也就是说,计算没有任何孩子的后代的数量。Cat 的XshiftYshift被保留。但我将内部重命名overall xxxxsmuggle xxxx。因为我们正在越过屏障偷运参数\pgftransformreset

\documentclass[tikz,border=9]{standalone}
\usetikzlibrary{mindmap}

\makeatletter
\newcount\tikz@count@leaf % count only leaf
\def\tikz@grow@concentric{
    \pgftransformreset%
    \pgftransformshift{\pgfpoint
        {\pgfkeysvalueof{/tikz/smuggle xshift}}
        {\pgfkeysvalueof{/tikz/smuggle yshift}}}
    \pgftransformrotate{
        \pgfkeysvalueof{/tikz/smuggle rotation}+
        (\pgfkeysvalueof{/tikz/sibling angle})*(\tikz@count@leaf)}
    \ifnum\pgfkeysvalueof{/tikz/nold}=0
        % this is a leaf
        \global\advance\tikz@count@leaf by1
    \else
        % this is not a leaf
        % we need to rotate it further
        \pgftransformrotate{
            (\pgfkeysvalueof{/tikz/sibling angle})*
            (\pgfkeysvalueof{/tikz/nold}-1)/2}
        \tikzset{nold/.initial=0} % reset for safty
    \fi
    \pgftransformxshift{\the\tikzleveldistance}
}

\begin{document}
\tikzset{
    smuggle rotation/.initial=0,
    smuggle xshift/.initial=0pt,
    smuggle yshift/.initial=0pt,
    Xshift/.style={xshift=#1,smuggle xshift=#1},
    Yshift/.style={yshift=#1,smuggle yshift=#1},
    Rotate/.style={smuggle rotate=#1},
    nold/.initial=0, % hint tikz the number of leaf in its descendants
    % explain: don't count a child if they have your grand-child
    branch color/.style={
        concept color=#1!white,
        every child/.append style={concept color=#1!white!30!white},
    }
}

\begin{tikzpicture}
    \draw foreach\i in{1,...,36}{
        (0:0)--(\i*10:15)
    };
    \begin{scope}[text width=1.5cm,align=flush center,
            mindmap,growth function=\tikz@grow@concentric,
            smuggle rotation=-30,
            sibling angle=10,
            nodes={concept},
            concept color=green!70!black,
            root concept/.append style={
                ball color=green!50,line width=1.5ex,text=green!40!black,
                font=\huge\bfseries\scshape,minimum size=4.5cm,text width=4.5cm
            },
            level 1/.style={
                level distance=8cm,font=\Large,
                minimum size=3.0cm,text width=2.5cm
            },
            level 2/.style={
                level distance=12cm,font=\large,
                minimum size=2.0cm,text width=2.0cm
            },
            level 3/.style={
                level distance=15cm,font=\large,
                minimum size=2.0cm,text width=2.0cm
            }
        ]
        \node [root concept]{Clients}
        child[nold=3,branch color=green!70]{node {Retail} 
            child {node {CGPI}} 
            child {node {Banques priv\'ees}}
            child {node {Retail banking}} 
        }
        child[nold=8,branch color=green!70]{node {ALM}
            child[nold=3]{ node (equity) {Equity}
                child { node {Indices}}
                child { node {Stocks}}
                child { node {ETFs}}
            }
            child[nold=3]{ node (commo) {Commodities}
                child { node {Soft commo}}
                child { node {Precious}}
                child { node {Oil/Gas}}
            }
            child {node {Assurances}}
            child {node {Caisse de retraite}}
        }
        child[nold=1,branch color=green!80]{node {Directions financieres}
            child {node {Corporate}}
        }
        child[nold=3,branch color=green!70]{node {Instrument specialists} 
            child {node {Asset Managers traditionnels}}
            child {node {Hedge funds}}
            child {node {Trading desks form other banks}}
        }
        ;
    \end{scope}
\end{tikzpicture}
\end{document}

相关内容