I am trying to generate a tree like:
Here is my code so far:
\documentclass{article}
\usepackage{tikz-qtree}
\begin{document}
\begin{tikzpicture}[every tree node/.style={font=\huge},
level distance=1.1cm,sibling distance=.8cm,
edge from parent path={(\tikzparentnode.south) -- +(0,-8pt) -| (\tikzchildnode)}],
frontier/.style={distance from root=350pt} % Align leaf nodes
\Tree
[
\edge node[near end,left] {branch};
[
\edge node[near end, left] {};
[
\edge node[] {}; [.a ]
\edge node[] {}; [.b ]
]
\edge node[] {}; [.c ]
]
\edge node[near end,right] {};
[
\edge node[] {}; [.d ]
\edge node[] {}; [.e ]
]
]
\node[draw] at (0,.2) {root};
\draw (1.6,-1.9) circle (1.3cm);
\draw[thick,->] (0,-4.5) -- (1,-3.2);
\node[draw] at (0,-5) {clade};
\end{tikzpicture}
\end{document}
Which produces the following (PDFLaTex):
My questions are:
- How to make all the leaves appear at the same level?
- Is there a better way of drawing circles than manually locating it on the tree?
- How to make the tree horizontal?
Best Answer
You can use the
fit
library to fit a node to a set of named nodes. If you use Forest to draw the tree, it offers thefit to=<nodewalk>
wrapper to make this easy.For example,