在每个节点后以特定样式在路径中插入命令

在每个节点后以特定样式在路径中插入命令

我想制作思维导图并将每片叶子与外部节点连接起来。我该怎么做?

在下面的例子中,我想连接每个

示例代码:

\tikzset{
        top concept/.style = {mindmap, concept color=orange},
        is6/.style = {concept},
        to6/.style = {concept},
        isConc/.style = {concept},
        toConc/.style = {concept}
}

\begin{tikzpicture}

\node[circle,draw] (thatnode) at (10,0)  {that other node};

\path[top concept] (0,20cm) node[isConc, insert path={circle[fill=red,radius=5cm]}] {Statistic} [clockwise from=0]
    child[toConc] { node[isConc] {general theory}
        child[to6] { node[is6] {intro to propability} }
        child[to6] { node[is6] {asymptotics and Law of large number} }
        child[to6] { node[is6] {asymptotics and Central Limit Theorem} }
    }
    child[toConc] { node[isConc] {distributions} [clockwise from=90]
        child[to6] { node[is6] {binomial distrubtion} }
        child[to6] { node[is6] {normal distribution} }
        child[to6] { node[is6] {poisson distribution} }
    }  
    child[toConc] { node[isConc] {statistics} [clockwise from=-30]
        child[to6] { node[is6] {variability, variance} }
        child[to6] { node[is6] {expected value} }
    }
    child[toConc] { node[isConc] {propability}
        child[to6] { node[is6] {propability mass functions} }
        child[to6] { node[is6] {propability density functions} }
        child[to6] { node[is6] {baye's rule} }
        child[to6] { node[is6] {independence} }
    }
    child[toConc] { node[isConc] {hypothesis testing}
        child[to6] { node[is6] {standard error of mean} }
        child[to6] { node[is6] {T confidence intervals} }
        child[to6] { node[is6] {T tests} }
        child[to6] { node[is6] {hypothesis testing} }
        child[to6] { node[is6] {two group testing} }
        child[to6] { node[is6] {pvalues} }
        child[to6] { node[is6] {power} } % (propability of rejecting null hypothesis when false)
        child[to6] { node[is6] {bootstrapping} }
        child[to6] { node[is6] {permutation tests} }
    }
;
\end{tikzpicture}

我想到了一些类似的事情:

\tikzset{
        is6/.style = {concept, concept color=col6, alias=this, append after command={(this) -- (thatnode)}},
        to6/.style = {concept, concept color=colI!50!col6},
}

小型工作示例:

我想融入(this) -- (othernode)这种风格。

\documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{shapes,arrows,chains,positioning,calc,trees,mindmap}

\tikzset{ is6/.style = {concept, concept color=green, text=black, alias=this}, to6/.style={concept}, isConc/.style={concept, color=orange, text=black}, toConc/.style={concept, text=black}}

\begin{document}

\begin{tikzpicture} \node[fill=red, circle] (othernode) at (7,7) {adsf}; \path[mindmap, concept, color=orange] (0,0cm) node[isConc] {Statistic} [clockwise from=90]     child[toConc] { node[isConc] {general theory}       child[to6] { node[is6] {intro}  (this) -- (othernode) }         child[to6] { node[is6] {outro} (this)  -- (othernode) }     }   child[toConc] { node[isConc] {distributions} [clockwise from=0]         child[to6] { node[is6] {binomial}  (this) -- (othernode)  }         child[to6] { node[is6] {normal} (this)  -- (othernode)  }   }   ;

\end{tikzpicture}

\end{document}

顺便提一句。Tikz \draw 作为样式的一部分(在某些类型的每个节点内绘制某些内容)不一样 ;-)。

答案1

如果othernode在绘制思维导图之前定义了,那么可以使用\pgfextra里面的命令style来绘制思维导图节点和其他节点之间的链接。

\documentclass[a4paper,10pt]{article} 
\usepackage[utf8]{inputenc} 
\usepackage{tikz} 
\usetikzlibrary{shapes,arrows,chains,positioning,calc,trees,mindmap}

\tikzset{
    is6/.style = {concept, concept color=green, 
                        text=black, alias=this,
                        append after command={
                        \pgfextra{
                            \draw[red,dashed] (this)--(othernode);}
                            }}, 
    to6/.style={concept}, 
    isConc/.style={concept, color=orange, text=black}, 
    toConc/.style={concept, text=black}}

\begin{document}

\begin{tikzpicture} 
\node[fill=red, circle] (othernode) at (7,7) {adsf}; 
\path[mindmap, concept, color=orange] (0,0cm) 
node[isConc] {Statistic} [clockwise from=90]        
    child[toConc]{node[isConc] {general theory}       
            child[to6] {node[is6] {intro}}         
            child[to6] {node[is6] {outro}}}   
    child[toConc] {node[isConc] {distributions} [clockwise from=0]                  
            child[to6] {node[is6] {binomial}}         
            child[to6] {node[is6] {normal}}   
            };
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容