Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have an ASCII-art phylogenetic tree that looks (in part) like

                 /------ PLN
           /-----+ 0.9
           |     \------ IL1
  /--------+ 1.8
  |        |      /----- PVD
  |        \------+ 0.8
  |               \----- URYD
--+ 3.1
  |                /----- PHB
  |             /--+ 0.7
  |             |  \----- FLP
  \-------------+ 0.8
                \----- PQR

I think I understand how to use the level distance command on the children to get different depths on each side of the branch, and the grow right command to get the tree in the proper orientation, but can I get the numbers to appear as shown here--to the right of the joining node? Should these be the text of some style of node, or are they labels on textless nodes, or...?

Also, as shown here, the subtrees are different from each other and asymmetric. At this point, am I better off just drawing nodes by hand without any tree, or is there an effective way to avoid collisions?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

forest offers a label option which can be used for this and makes quite a neat tree from very compact code. I'm not sure just how the tree should look so this may not be quite right, but it can be modified fairly easily.

\documentclass[tikz, border=5pt]{standalone}


  /tikz/label position=right,
  /tikz/label distance=.5em,
  for tree={
    parent anchor=east,
    child anchor=west,
    before typesetting nodes={
      if content={}{
    edge path={
      \noexpand\path [draw, \forestoption{edge}] (!u.parent anchor) -- +(5pt,0) |- (.child anchor)\forestoption{edge label};
    if n children=2{
      for children={
        edge={rounded corners},
    [, label=3.1
      [, label=0.8
        [, label=0.7
      [, label=1.8
        [, label=0.8
        [, label=0.9


<code>forest</code> tree

share|improve this answer
That's great! If I do this again, this does exactly what I want, so I will surely use this. (I may end up drawing my own in SVG for other reasons, however.) – Rex Kerr Jun 28 at 23:58
@RexKerr I'm a bit of a fan of forest ;). – cfr Jun 29 at 0:07

Textless node seems the easiest idea.

\begin{tikzpicture}[edge from parent path={
            (\tikzparentnode.east) -- ++ (2mm,0) [rounded corners] |- (\tikzchildnode.west)
\node (root) {} [grow=right]
child {
child {coordinate (special)}
\node[label={[inner sep=1mm]0:Label}] at (root-2) {};

enter image description here

share|improve this answer
Thanks! This is what I ended up doing, though I had to manually keep track of the height of the two halves of each tree and use custom sibling distance on every node. (By "manually" I mean that the code that I wrote to generate the tikz commands kept track, instead of tikz doing it.) – Rex Kerr Jan 22 '12 at 5:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.