Please show me the most simple, elegant code for this:

enter image description here

How to do it in other words.


You can do this sort of tree easily with the tikz-qtree package:

In the code below, the labels are created using a tree with branches that are not actually drawn (using a style blank which sets [draw=none]). This ensures that they line up with the levels of the main tree. By putting two trees as nodes in a matrix we achieve a reasonable separation between the labels and the main tree.

\tikzset{edge from parent/.style=
{draw, edge from parent path={(\tikzparentnode.south)
-- +(0,-8pt)
-| (\tikzchildnode)}},
    [.Class  \edge[blank]; 
    [.Order  \edge[blank];
    [.Family \edge[blank]; 
    [.Genus ]]]]};
        [.Alteromonadaceae  {Glaciecola}  Alteromonas Agarivorans ] ]
    [.Vibrionales [.Vibrionacae Vibrio ]]]};\\


output of code

  • Thanks. Is there any way to create a bit more distance between the labels on the left hand side (Class, Order, ...) and the graph?
    – ptrcao
    May 26 '11 at 1:08
  • 2
    @ptrcao I've modified the example to make two trees in a matrix of nodes instead of one tree. This gives more space between the labels, since the labels are no longer connected to the main tree.
    – Alan Munn
    May 26 '11 at 2:24

run with xelatex




enter image description here

  • Any way to offset the Alteromonas branch slightly? I'm not sure if it's necessary but I see it often being done in biology and I'm tempted to think it's deliberate, to avoid giving that branch the appearance of receiving special treatment or greater relational weight, relative to the others...
    – ptrcao
    May 26 '11 at 0:46
  • 1
    all can be set locally by thistreesep or thislevelsep
    – user2478
    May 26 '11 at 6:37
  • @Herbert I'm sorry for being a nuisance, can you please show explicitly? I'm really new at this! :|
    – ptrcao
    May 26 '11 at 8:35
  • 1
    @ptrcao: ah that's simple, see edited answer
    – user2478
    May 26 '11 at 9:08
  • 1
    @ptrcao: insert -shell-escape after the %O and load package autp-pst-pdf ($pdflatex=q/pdflatex -synctex=1 %O -shell-escape %S/). You have to insert a new entry (+) move it up and then delete the old one. It makes sense that you have installed Perl (actibestate.com/perl) then the very useful program pdfcrop can be used.
    – user2478
    May 26 '11 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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