![树中从子节点到父节点的箭头](https://linux22.com/image/416871/%E6%A0%91%E4%B8%AD%E4%BB%8E%E5%AD%90%E8%8A%82%E7%82%B9%E5%88%B0%E7%88%B6%E8%8A%82%E7%82%B9%E7%9A%84%E7%AE%AD%E5%A4%B4.png)
对于代码和图像,我想将线条从子节点变成父节点的虚线箭头。我尝试使用边缘构造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}