思维导图 - 2 级条件锚定

思维导图 - 2 级条件锚定

cfr 的漂亮解决方案允许使用2 级节点的样式类似于注释

截然不同的方法这个或者那个添加额外节点的位置外部思维导图本身。

然而,我正在努力level 2使它看起来更和谐,如下所示(我在油漆上作弊以显示预期的结果)。

我想象这个想法是有一个移动的锚点(east对于level 2左侧的节点,west锚点在思维导图的右侧节点上?更细粒度,倾斜以遵循从 1 级开始的路径?我不知道什么是可行的)。话虽如此,我无法找到如何区分这些情况的起点 :/

在此处输入图片描述

% original MWE from cfr.
\documentclass[border=10pt]{standalone}
\usepackage[condensed,math]{iwona}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames,svgnames]{xcolor}
\usepackage{tikz}

\usetikzlibrary{mindmap,trees,positioning}
\tikzset{
  set angles for level/.style={level #1/.append style={sibling angle=360/(\the\tikznumberofchildren+4)}},
  level/.append code={
    \edef\tempa{#1}\edef\tempb{1}
    \ifx\tempa\tempb\tikzset{level 1/.append style={sibling angle=360/\the\tikznumberofchildren}}\else\tikzset{set angles for level=#1}\fi},
%     set angles for level=#1},% solution 1
  non-concept/.style={
    rectangle,
    text width=15em,
    text=black,
    align=left,
    font=\large,
  },
  cncc/.style={ edge from parent path={ (\tikzparentnode.#1) to [bend right] (\tikzchildnode)   } },
}
\begin{document}
\begin{tikzpicture}[level 1 concept/.append style={font=\large, level distance=150}]
  \path[mindmap, concept color=Aquamarine, grow cyclic]
  node[concept] {ICF Core \\ Competencies}%[clockwise from=45]
  child[concept color=blue!20!white] {
    node[concept] (def) {Setting the Foundation}
    child[level distance=5cm] { node[non-concept] {Meeting Ethical Guidelines \& Professional Standards} edge from parent[cncc=west] }
    child[level distance=5cm] { node[non-concept] {Establishing the Coaching Agreement} edge from parent[cncc=west] }
  }
  child[concept color=Pink]  { node[concept] {Co-creating the \\ Relationship} 
    child[level distance=5cm] { node[non-concept] {Establishing Trust \& Intimacy with the Client} edge from parent[cncc=south] }
    child[level distance=5cm] { node[non-concept] {Coaching Presence} edge from parent[cncc=south] } 
  }
  child[concept color=Bisque]{ node[concept] {Communicating Effectively} 
    [clockwise from=0]
    child[level distance=5cm] { node[non-concept] {Establishing Trust \& Intimacy with the Client} edge from parent[cncc=east] }
    child[level distance=5cm] { node[non-concept] {Coaching Presence} edge from parent[cncc=east] }    
    child[level distance=5cm] { node[non-concept] {Coaching Presence} edge from parent[cncc=south] }    
  }
  child[concept color=Cyan]  { node[concept] {Facilitating Learning \& Results} 
    [clockwise from=90]
    child[level distance=5cm] { node[non-concept] {Establishing Trust \& Intimacy with the Client} edge from parent[cncc=west] }
    child[level distance=5cm] { node[non-concept] {Coaching Presence} edge from parent[cncc=west] } 
    child[level distance=5cm] { node[non-concept] {Coaching Presence} edge from parent[cncc=north] } 
    child[level distance=5cm] { node[non-concept] {Coaching Presence} edge from parent[cncc=east] }     
  };
\end{tikzpicture}
\end{document}

答案1

如果您想要将路径与 2 级条目完美对齐,则需要手动调整它们。因为它取决于文本宽度、条目的最小大小和锚点。我在 中添加了两个参数,non-concept/.style并在 中添加了一个参数cncc/.style。在 中non-concept/.style,第一个参数 #1 用于指定文本宽度,第二个参数 #2 用于指定 2 级节点的最小大小。在 中cncc/.style,第一个参数 #1 仍然是 1 级父节点的锚点,第二个参数 #2 是 2 级子节点的锚点。我还为每个 2 级条目添加了框架,以便明确看到效果(注释掉 中将draw不会non-concept/.style添加框架)。您可以调整这些参数,使图形接近问题中的预期结果。此外,在某些情况下,您可能需要使用shift手动调整 2 级条目的位置(例如child[shift={(2.5cm,-3cm)},level distance=5cm])。

以下是代码:

% original MWE from cfr.
\documentclass[border=10pt]{standalone}
\usepackage[condensed,math]{iwona}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames,svgnames]{xcolor}
\usepackage{tikz}

\usetikzlibrary{mindmap,trees,positioning}
\tikzset{
set angles for level/.style={level #1/.append style={sibling angle=360/(\the\tikznumberofchildren+4)}},
level/.append code={
\edef\tempa{#1}\edef\tempb{1}%
\ifx\tempa\tempb\tikzset{level 1/.append style={sibling angle=360/\the\tikznumberofchildren}}\else\tikzset{set angles for level=#1}\fi},
%     set angles for level=#1},% solution 1
non-concept/.style 2 args={
draw, % comment to make no frames
minimum size=#2,
text width=#1,
text=black,
align=left,
font=\large,
},
cncc/.style n args={2}{ edge from parent path={ (\tikzparentnode.#1) to [bend right] (\tikzchildnode.#2)   } },
}
\begin{document}
\begin{tikzpicture}[level 1 concept/.append style={font=\large, level distance=150}]
\path[mindmap, concept color=Aquamarine, grow cyclic] 
node[concept] {ICF Core \\ Competencies}%[clockwise from=45]
child[concept color=blue!20!white] {
node[concept] (def) {Setting the Foundation}
child[level distance=5cm] { node[non-concept={14em}{1cm}] {Meeting Ethical Guidelines \& Professional Standards} edge from parent[cncc={west}{north}] }
child[shift={(-2cm,1.5cm)},level distance=5cm] { node[non-concept={12em}{1cm}] {Establishing the Coaching Agreement} edge from parent[cncc={west}{north west}]}
}
child[concept color=Pink] { 
node[concept] {Co-creating the \\ Relationship} 
child[level distance=5cm] { node[non-concept={14em}{1cm}] {Establishing Trust \& Intimacy with the Client} edge from parent[cncc={south}{north west}] }
child[level distance=6cm] { node[non-concept={9em}{0.5cm}] {Coaching Presence} edge from parent[cncc={south}{south west}] } 
}
child[text width=7em,concept color=Bisque]{ node[concept] {Communicating Effectively} [clockwise from=0]
child[shift={(2.5cm,-3cm)},level distance=5cm] { node[non-concept={14em}{1cm}] {Establishing Trust \& Intimacy with the Client} edge from parent[cncc={east}{south west}] }
child[level distance=5cm] { node[non-concept={9em}{0.5cm}] {Coaching Presence} edge from parent[cncc={east}{west}] }    
child[level distance=5cm] { node[non-concept={9em}{0.5cm}] {Coaching Presence} edge from parent[cncc={south}{north west}] }    
}
child[concept color=Cyan]  { node[concept] {Facilitating Learning \& Results} 
[clockwise from=90]
child[level distance=5cm] { node[non-concept={14em}{1cm}] {Establishing Trust \& Intimacy with the Client} edge from parent[cncc={west}{north}] }
child[level distance=5cm] { node[non-concept={8.8em}{0.5cm}] {Coaching Presence} edge from parent[cncc={west}{north east}] } 
child[level distance=5cm] { node[non-concept={8.8em}{0.5cm}] {Coaching Presence} edge from parent[cncc={north}{east}] } 
child[level distance=5cm] { node[non-concept={8.8em}{0.5cm}] {Coaching Presence} edge from parent[cncc={east}{south east}] }     
};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容