How to include horizontal arrows in between nodes in TiKz
pure tikz
solution:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
level 1/.style={level distance=1cm,sibling distance=3cm},
level 2/.style={level distance=2cm,sibling distance=2cm},
level 3/.style={level distance=1.5cm,sibling distance=2cm},
V/.style = {circle, fill,inner sep=2pt}
]
\node (Root)[V,label=above:{\textsc{pucd}}] {}
child { node (A) [V,label=left:{pre-\textsc{puc}}] {}
child { node (B) [V,label=left:{\textsc{puc}}] {}
child { node[V,label=below:{Uwahaza}] {} }
child { node[V,label=below:{Cakaria}] {} }
}
}
child { node[V,below=19mm,label=below:{Danundaga}] {} }
;
\path (A) -- (B) node[pos=0.3] (p1) {} node[pos=0.5] (p2) {} node[pos=0.7] (p3) {};
\draw[dashed, <-] (p1) -- ++ (-1.2,0);
\draw[dashed, <-] (p2) -- ++ (-1.2,0) node[left, align=right] {?????\\influence};
\draw[dashed, <-] (p3) -- ++ (-1.2,0);
\end{tikzpicture}
\end{document}
On your image arrows and text at it is not readable not clear, how they should looks. However, in my MWE their position and text can be easy to change.
However, I’m not sure how to approach the horizontal arrows which are located in between two nodes, and their label to the left of them.
The only problem is to properly position the nodes. To do that, the simpler is to add names to the nodes in your tree and to use standard tikz positioning methods to place the text and the arrows.
Second of all, I’m not sure what the best way is to get a branch to reach two levels without inserting a node in between. I change the length of it, but it makes the sibling distance a bit uneven.
Even in a graph, nodes can be put at a specific position. Using child { node[right of=another node, xshift=2cm,...]...
will put the node at the same Y position as 'another node', whatever the level in the graph of either of them.
Third of all, my labels have been placed very far from the nodes and I would like them closer.
For labels, you can use the syntax ...,label={[below,yshift=1cm]{my label}}
to control their vertical (or horizontal) position.
\documentclass{article}
\usepackage{tikz}
\usepackage{forest}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[
level 1/.style={level distance=1cm,sibling distance=3cm},
level 2/.style={level distance=2cm,sibling distance=2cm},
level 3/.style={level distance=1.5cm,sibling distance=2cm}]
% \tikzstyle{every node}=[circle,draw,fill,inner sep=0pt,minimum size=4pt]
% include a scope to limit the default node style
\begin{scope}[every node/.style={circle,draw,fill,inner sep=0pt,minimum size=4pt}]
\node (Root)[label={[above,yshift=-0.2cm]{\textsc{pucd}}}] {}
child { node[label=left:{pre-\textsc{puc}}] (pre-puc) {}
child { node[label=left:{\textsc{puc}}] (puc) {}
child { node[label={[below,yshift=0.3cm]{Uwahaza}}] {} }
child { node[label={[below,yshift=0.3cm]{Cakaria}}] {} }
} }
child { node[right of=puc, xshift=2cm,label={[below,yshift=0.4cm]{Danundaga}}] {} }
;
\end{scope}
\node (non-og) at ([xshift=-2cm]$(pre-puc)!0.3!(puc)$) {non-og};
\node (influence) at ([xshift=-2cm]$(pre-puc)!0.7!(puc)$) {influence};
\draw[->,dashed] (non-og) -- (non-og-|puc);
\draw[->,dashed] ([yshift=0.05cm]influence.north east) -- ([yshift=0.05cm]influence.north-|puc);
\draw[->,dashed] ([yshift=-0cm]influence.east) -- ([yshift=-0cm]influence.east-|puc);
\draw[->,dashed] ([yshift=-0.05cm]influence.south east) -- ([yshift=-0.05cm]influence.south-|puc);
\end{tikzpicture}
\end{document}
This is another "plain" TikZ code.
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\path
(0,0) coordinate (A) node[above=2mm]{PUCD}
++(-150:2) coordinate (B) node[left=2mm]{pre-PUCD}
++(-90:2.5) coordinate (C) node[left=2mm]{PUC}
+(-120:2) coordinate (D) node[below=2mm]{Uwahaza}
+(-60:2) coordinate (E) node[below=2mm]{Cakaria}
+(0:3.5) coordinate (F) node[below=2mm]{Danundaga};
\draw (A)--(B)--(C)--(D) (C)--(E) (A)--(F);
\foreach \p in {A,B,C,D,E,F} \fill (\p) circle(1mm);
\path (B)--(C)
coordinate[pos=.35] (L1)
coordinate[pos=.5] (L2)
coordinate[pos=.65] (L3);
\draw[<-,dashed] (L1)++(180:.3)--+(180:1.5);
\draw[<-,dashed] (L3)++(180:.3)--+(180:1.5);
\draw[<-,dashed] (L2)++(180:.3)--+(180:1.5)
node[left,align=center]{non-dg\\influence};
\end{tikzpicture}
\end{document}