Template:Clade/doc

This template is used for drawing branching trees with the node and base labels being clickable links. Such diagrams are especially suited to represent evolutionary trees (cladograms).

See Cladex for two extra features:
 * Double lines leading to a node can be produced as easily as dotted lines.
 * Brackets or bars of a chosen colour can be placed to the right of a set of leaf nodes in the cladogram, thus allowing paraphyletic groups to be identified.

Usage
produces

produces

produces

Note that the order of the parameters does not matter. Exactly the same output is produced by

produces

To replace a solid line leading to the Nth child with a dashed line, use |stateN=dashed.

produces

Tips
An easy way of creating larger cladograms is to use the Newick format and proceed to edit it using a suitable text editor to produce the markup.


 * 1) Start with Newick format ((a,b),(c,d))
 * 2) Replace "(" with ""
 * 3) Edit to replace commas with pipes and numbers
 * 4) Edit clade labels if needed

Example Perl script to automate the conversion:

Using a box
You can nest the templates and use links around the text. You may use non-breaking spaces (&amp;nbsp;) to obtain spaces or to have labels that have spaces.

The entire cladogram can be placed in a box so that text flows nicely around it. You can use undefined to produce the box.

Controlling the layout of sisters
When one sister is represented as a leaf node and the other as a labelled subclade, they do not appear to be at the same level. Consider this cladogram:

Although Banksia subser. Sphaerocarpae and Banksia subser. Leptophyllae are sisters, their names are not aligned in the cladogram. If this is considered undesirable, one solution is to use a label in both cases, as shown below, which now shows the sisters at the same level.

Another 'trick' is to introduce a dummy clade. The dotted line below shows where an extra clade has been inserted:

To achieve this, instead of use

Label length
Labels produced by |labelN=, where N is 1, 2, ..., can lead to poor layout of the resulting cladogram. (This does not apply to the text of leaves, i.e. text produced by |N=.) To avoid problems:
 * labels should be kept as short as possible, ideally a single word
 * any necessary spaces in labels should be represented as &amp;nbsp; not as actual spaces
 * line breaks (i.e.  ) should not be used.

Browser differences
Clade works by producing hidden tables. The horizontal and vertical lines making up the tree are actually the edges of table cells. The tables are then drawn by the browser or user agent using its internal algorithms. As these differ from browser to browser, the trees produced will not look the same on all browsers.

In particular, there are two algorithms for laying out tables with empty cells, used by two groups of browsers. Safari, Chrome and Opera use one algorithm, producing cladograms like that on the left in the diagram. Internet Explorer and Firefox use another algorithm, producing cladograms like that on the right in the diagram.

No automated "fix" for these differences exists at present.

Large cladograms
Clade has some size limitations.
 * It currently allows only a maximum of 17 children per node. It may seem that this could easily be increased by editing the template, but see the next point.
 * It will only expand a cladogram up to a certain level of complexity because the MediaWiki software limits the resources available for template expansion. The cladogram at APG_III_system has had to be broken into two parts, because Clade will not handle the entire cladogram; it runs out of the allowed resources. Any change to the template could result in large cladograms failing to display correctly.

Inclusion in books
There are many known bugs in rendering tables in the software which produces Wikipedia books; see the book tool feedback page. these result in the lines in cladograms not displaying in books.