我想将思维导图顺时针旋转 45 度,但我想保持最终节点的对齐为四分之一圆。
我尝试了不同的选项,例如 rotate=45 或 yshift=xxpt改变 tikz 思维导图节点的方向但没有影响。我错在哪里?我改编了代码如何将 2 级概念思维导图节点放在矩形旁边
这是 MWE
\documentclass[tikz,border=9]{standalone}
\usetikzlibrary{mindmap,decorations}
\usepackage{xspace}
\definecolor{joli}{RGB}{225,95,0}
\definecolor{JOLI}{RGB}{225,95,0}
\newcommand\etoc{\textcolor{joli}{\ttfamily\bfseries etoc}\xspace}
\DeclareRobustCommand\csa[1]{{\ttfamily\hyphenchar\font45 \char`\\ #1}}
\makeatletter
\newcount\tikzcountgrandchild
\def\tikz@grow@concentric{%
\pgftransformreset%
\pgftransformrotate{(\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
}
\begin{document}
\tikzset{
noc/.initial=0,
branch color/.style={
concept color=#1!white,
every child/.append style={concept color=#1!white!30!white},
}
}
\begin{tikzpicture}[text width=1.5cm,align=flush center,
mindmap,growth function=\tikz@grow@concentric,
sibling angle=360/30,
nodes={concept},
concept color=gray!60,
root concept/.append style={concept color=green!50, 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}
]
\node [root concept]{Clients}
child[noc=3,branch color=green!70]{node {Retail}
child[] {node {CGPI}}
child[] {node {Banques privées}}
child[] {node {Retail banking}}
}
child[noc=3,branch color=green!70]{node {ALM}
child[] {node {Mutuelles}}
child[] {node {Assurances}}
child[] {node {Caisse de retraite}}
}
child[noc=1,branch color=green!80]{node {Directions financières}
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{tikzpicture}
\end{document}
答案1
我添加了一个键overall rotation
来实现这一点。(我的编辑器很老旧,不支持非 ASCII 字符,希望我没有搞错重音符号。)
\documentclass[tikz,border=9]{standalone}
\usetikzlibrary{mindmap,decorations}
\usepackage{xspace}
\definecolor{joli}{RGB}{225,95,0}
\definecolor{JOLI}{RGB}{225,95,0}
\newcommand\etoc{\textcolor{joli}{\ttfamily\bfseries etoc}\xspace}
\DeclareRobustCommand\csa[1]{{\ttfamily\hyphenchar\font45 \char`\\ #1}}
\makeatletter
\newcount\tikzcountgrandchild
\def\tikz@grow@concentric{%
\pgftransformreset%
\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
}
\begin{document}
\tikzset{overall rotation/.initial=0,
noc/.initial=0,
branch color/.style={
concept color=#1!white,
every child/.append style={concept color=#1!white!30!white},
}
}
\begin{tikzpicture}[text width=1.5cm,align=flush center,
mindmap,growth function=\tikz@grow@concentric,
overall rotation=-45,
sibling angle=360/30,
nodes={concept},
concept color=gray!60,
root concept/.append style={concept color=green!50, 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}
]
\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 {Mutuelles}}
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{tikzpicture}
\end{document}
或许您想稍微改变一下颜色。
\documentclass[tikz,border=9]{standalone}
\usetikzlibrary{mindmap,decorations}
\usepackage{xspace}
\definecolor{joli}{RGB}{225,95,0}
\definecolor{JOLI}{RGB}{225,95,0}
\newcommand\etoc{\textcolor{joli}{\ttfamily\bfseries etoc}\xspace}
\DeclareRobustCommand\csa[1]{{\ttfamily\hyphenchar\font45 \char`\\ #1}}
\makeatletter
\newcount\tikzcountgrandchild
\def\tikz@grow@concentric{%
\pgftransformreset%
\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
}
\begin{document}
\tikzset{overall rotation/.initial=0,
noc/.initial=0,
branch color/.style={
concept color=#1!white,
every child/.append style={concept color=#1!white!30!white},
}
}
\begin{tikzpicture}[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}
]
\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 {Mutuelles}}
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{tikzpicture}
\end{document}