树中从子节点到父节点的箭头

树中从子节点到父节点的箭头

对于代码和图像,我想将线条从子节点变成父节点的虚线箭头。我尝试使用边缘构造parent[->, dashed],但做不到。我不需要形状或框中的节点,也不需要彩色线条。

谢谢,

大卫

\usepackage{tikz}

 \usetikzlibrary{trees, arrows}

 \begin{document}

    \begin{figure}[ht]
    
    \begin{center}
    \tikz [font=\small,
    
    grow=left, level 1/.style={sibling distance=12em},
    
    level 2/.style={sibling distance=3em}, level distance=5cm, edge to parent/.style={draw,-latex}]
    
    \tikzstyle{bag} = [align=left]
    
    \node[bag] (n00) {Process Description} % root
    
    child { node[bag] (n01) {Connectivity\\ From Process Knowledge}
    
    child { node[bag] (n02) {Process Layout}}
    
    child { node[bag] (n03) {Structural Modelling}}
    
    child { node[bag] (n04) {Adjacency Matrices}}
    }
    child { node[bag] (n05){Causality \\From Process Data}
    
    child { node[bag] (n06) {Cross Correlation}}
    
    child { node[bag] (n07) {Granger Causality}}
    
    child { node[bag] (n08) {Information Theory}}
    
    child { node[bag] (n09) {Bayesian Networks}}
    
    child { node[bag] (n10) {(Machine Learning)}}
    
    };
    
    \end{center}
    
    \caption{Stuff.}
    
    \label{fig:Yang_01}    
    
    \end{figure}

    \end{document}

文本在此处输入图片描述

答案1

请以良好的格式组织您的代码。

使用edge from parent/.style={draw, dashed, <-}来获得虚线箭头。

\documentclass[tikz, border=1cm]{standalone}
\tikzstyle{bag} = [align=left]

\begin{document}
\tikz [font=\small,
  grow=left,
  level 1/.style={sibling distance=12em},
  level 2/.style={sibling distance=3em},
  level distance=5cm,
  edge from parent/.style={
    draw, dashed, <-,
  }
]
\node[bag] (n00) {Process Description} % root
child { node[bag] (n01) {Connectivity\\ From Process Knowledge}
  child { node[bag] (n02) {Process Layout}}
  child { node[bag] (n03) {Structural Modelling}}
  child { node[bag] (n04) {Adjacency Matrices}}
}
child { node[bag] (n05){Causality \\From Process Data}
  child { node[bag] (n06) {Cross Correlation}}
  child { node[bag] (n07) {Granger Causality}}
  child { node[bag] (n08) {Information Theory}}
  child { node[bag] (n09) {Bayesian Networks}}
  child { node[bag] (n10) {(Machine Learning)}}
};
\end{document}

在此处输入图片描述

相关内容