I wish to draw a phylogenetic tree which is graphically rich (the edges may have several colours/styles), and more importantly, the tree would be aligned with a timeline, which need not be linear.

The closest example I could find to what I was looking for is the following:

enter image description here

Taken from here.

The animal pictures on the right are nice, but I do not really care about these. The colour bars are also nice, but again, not of significant importance. The two elements in this picture that I would like to have are the dashed line, and the timeline (which is implemented here as vertical white bars with a label at the bottom). Since the labels seem custom, I can make the timeline "non-linear". I also find it useful to control the font of the animal labels (as they did in the picture with dog).

I first thought that the newicktree package should do the job, but after reading its documentation, it seems rather simple, and probably incapable for such a task. The next guess would be tikz, but I have less experience with it, and it has quite a lot of packages. Do you think any of these fits such a task?

Just to make it clear, I am only interested in being able to produce the result, I do not care much about the syntax needed. For example, I don't care if the input will be the classical Newick tree format, as suggested in this question. I am also ok with a non-automated process of creating such a tree, as I don't need to do it more than once probably.

Do you have any suggestions?

  • 2
    I suggest the forest package. TikZ would be good too, but forest produces beautiful trees with less code and I think is generally more appropriate for this kind of tree.
    – Alenanno
    Jan 1, 2016 at 12:43

1 Answer 1


Here's a short example with the forest package. I made the lower part of the graph. Very basic, no colors, but that's up to you to change according to your taste.





\usetikzlibrary{positioning, backgrounds}

    timeline/.style={text centered, text width=2cm},
     no edge from this parent/.style={
        every child/.append style={
        edge from parent/.style={draw=none}}},

    every leaf node/.style={
        if n children=0{#1}{}
    every tree node/.style={
        if n children=0{}{#1}
        for tree={
            edge path={
            \noexpand\path [draw, thick, \forestoption{edge}] (!u.parent anchor) |- (.child anchor)\forestoption{edge label};
            every tree node={draw=none,inner sep=0, outer sep=0, minimum size=0},
            every leaf node/.style={align=left},
            parent anchor=east, 
            child anchor=west,
            l sep=2cm,
            s sep=3mm,
    if n children=0{tier=word}{}

\begin{forest} mytree
[,phantom, name=lvl0
            [gray fox ] 
            [island fox,edge=dashed ]
                [black bear ]
                [giant panda ] 
                [northern elephant seal ]
                [walrus ] 
\coordinate (tml) at (0,-3.5);
\begin{scope}[on background layer]
\foreach \age [count=\x starting from 1] in {
    {10 million years ago},
    {7.4 million years ago},
    {4 million years ago}
    \node[timeline] (age\x) at (tml-|lvl\x) {\age};
    \draw[gray] (age\x) --++ (0,6);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .