tikz 虚线边缘没有显示出来

tikz 虚线边缘没有显示出来

尝试绘制树形图,我需要一些虚线边,但虚线出现在直线上,导致其不显示(中间的节点) 在此处输入图片描述

这是我尝试过的代码

\begin{figure}[H]
\centering
    \begin{tikzpicture}
    \node (root){\includegraphics[scale=0.08]{img/hanging-over-the-key.eps}}
    child {node (a){\includegraphics[scale=0.08]{img/key.eps} }}
    child {node (b){\includegraphics[scale=0.08]{img/key.eps} }}
    child {node (c){\includegraphics[scale=0.08]{img/key.eps} }};
    \path (b) -- (c) node [midway] {$\cdots$};
    \path[->, dashed] (root) edge node {} (b);
    \path[->] (root) edge node {} (a);
    \path[->] (root) edge node {} (c);
    \end{tikzpicture}
\end{figure}

答案1

edge from parents是你的朋友:

在此处输入图片描述

\begin{tikzpicture}[level distance=33mm, sibling distance=22mm]
\node (root){\includegraphics[width=11mm, height=11mm]{img/hanging-over-the-key.eps}}
child {node (a){\includegraphics[width=11mm, height=11mm]{img/key.eps} }}
child {node (b){\includegraphics[width=11mm, height=11mm]{img/key.eps} }
                 edge from parent[dashed,->]} % <----
child {node (c){\includegraphics[width=11mm, height=11mm]{img/key.eps} }};
\path (b) -- (c) node [midway] {$\cdots$};
\path[->] (root) edge node {} (a);
\path[->] (root) edge node {} (c);
\end{tikzpicture}

抱歉,我没有你的图片。

相关内容