Difference between revisions of "Template:Cladex/doc"

From blackwiki
Jump to navigation Jump to search
imported>Peter coxhead
imported>Peter coxhead
Line 8: Line 8:
 
The two extra features of {{tl|Cladex}} are:
 
The two extra features of {{tl|Cladex}} are:
 
* Double lines leading to a node can be used as easily as dotted lines.
 
* Double lines leading to a node can be used 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 [[Paraphyly|paraphyletic]] groups to be identified. See [[#Bracketting nodes]]. '''Note that this feature only works with a cladograms with a very limited set of shapes.'''
+
* Brackets or bars of a chosen colour can be placed to the right of a set of leaf nodes in the cladogram, thus allowing [[Paraphyly|paraphyletic]] groups to be identified. See [[#Bracketting nodes]].
  
{{tl|Clade}} and {{tl|Cladex}} can be freely mixed, so if only one clade requires either of the extra features, only this one need be specified using {{tl|Cladex}}.
+
{{tl|Clade}} and {{tl|Cladex}} can be freely mixed, so if only some clades requires either of the extra features, only these need be specified using {{tl|Cladex}}.
  
 
==Basic features==
 
==Basic features==
 +
 +
'''Use {{tl|Clade}} unless the extra features of {tl|Cladex}} are needed.'''
  
 
=== Usage ===
 
=== Usage ===
Line 18: Line 20:
 
<pre>
 
<pre>
 
<nowiki>
 
<nowiki>
{{cladex
+
{{clade
 
|label1=Base
 
|label1=Base
 
|1=Node
 
|1=Node
Line 27: Line 29:
 
produces
 
produces
  
{{cladex
+
{{clade
 
|label1=Base
 
|label1=Base
 
|1=Node
 
|1=Node
Line 34: Line 36:
 
<pre>
 
<pre>
 
<nowiki>
 
<nowiki>
{{cladex
+
{{clade
|1={{cladex
+
|1={{clade
 
   |label1=[[Subtree1]]
 
   |label1=[[Subtree1]]
 
   |1=Leaf1
 
   |1=Leaf1
Line 47: Line 49:
 
produces
 
produces
  
{{cladex
+
{{clade
|1={{cladex
+
|1={{clade
 
   |label1=[[Subtree1]]&nbsp;
 
   |label1=[[Subtree1]]&nbsp;
 
   |1=Leaf1
 
   |1=Leaf1
Line 58: Line 60:
 
<pre>
 
<pre>
 
<nowiki>
 
<nowiki>
{{cladex| style=font-size:75%;line-height:75%
+
{{clade| style=font-size:75%;line-height:75%
|1={{cladex
+
|1={{clade
 
   |label1=Subtree1
 
   |label1=Subtree1
 
   |1=Leaf1
 
   |1=Leaf1
Line 71: Line 73:
 
produces
 
produces
  
{{cladex| style=font-size:75%;line-height:75%
+
{{clade| style=font-size:75%;line-height:75%
|1={{cladex
+
|1={{clade
 
   |label1=Subtree1
 
   |label1=Subtree1
 
   |1=Leaf1
 
   |1=Leaf1
Line 82: Line 84:
 
<pre>
 
<pre>
 
<nowiki>
 
<nowiki>
{{cladex
+
{{clade
|1={{cladex
+
|1={{clade
   |1={{cladex | thickness=3
+
   |1={{clade | thickness=3
 
       |1=Leaf1
 
       |1=Leaf1
 
       |2=Leaf2
 
       |2=Leaf2
Line 96: Line 98:
 
produces
 
produces
  
{{cladex
+
{{clade
|1={{cladex
+
|1={{clade
   |1={{cladex | thickness=3
+
   |1={{clade | thickness=3
 
       |1=Leaf1
 
       |1=Leaf1
 
       |2=Leaf2
 
       |2=Leaf2
Line 106: Line 108:
 
}}
 
}}
  
To replace the solid line with a dashed line, use |stateN=dashed:
+
To replace the solid line with a dashed line, use |stateN=dashed.
 
<pre>
 
<pre>
 
<nowiki>
 
<nowiki>
{{cladex
+
{{clade
|1={{cladex
+
|1={{clade
   |1={{cladex
+
   |1={{clade
 
       |1=Leaf1|state1=dashed
 
       |1=Leaf1|state1=dashed
 
       |2=Leaf2
 
       |2=Leaf2
Line 122: Line 124:
  
 
produces
 
produces
{{cladex
+
{{clade
|1={{cladex
+
|1={{clade
   |1={{cladex
+
   |1={{clade
 
       |1=Leaf1|state1=dashed
 
       |1=Leaf1|state1=dashed
 
       |2=Leaf2
 
       |2=Leaf2
Line 132: Line 134:
 
}}
 
}}
  
'''{{tl|Cladex}} only.''' To replace a single line leading to the Nth child by a double line, use <tt>|stateN=double</tt>:
+
'''{{tl|Cladex}} only.''' To replace a single line leading to the Nth child by a double line, use <tt>|stateN=double</tt>.  Notice that {{tl|cladex}} has only been used for the (sub)clade where the double line is wanted. The outermost clade should always be specified with {tl|clade}} unless its style is altered – see below.
 
<pre>
 
<pre>
 
<nowiki>
 
<nowiki>
{{cladex
+
{{clade
|1={{cladex
+
|1={{clade
 
   |1={{cladex
 
   |1={{cladex
 
       |1=Leaf1
 
       |1=Leaf1
Line 148: Line 150:
  
 
produces
 
produces
{{cladex
+
{{clade
|1={{cladex
+
|1={{clade
 
   |1={{cladex
 
   |1={{cladex
 
       |1=Leaf1
 
       |1=Leaf1
Line 163: Line 165:
  
 
# Start with [[Newick format]] ((a,b),(c,d))
 
# Start with [[Newick format]] ((a,b),(c,d))
# Replace "(" with <nowiki>"{{cladex|"</nowiki>
+
# Replace "(" with <nowiki>"{{clade|"</nowiki>
 
# Replace ")" with <nowiki>"}}"</nowiki>
 
# Replace ")" with <nowiki>"}}"</nowiki>
 
# Edit to replace commas with pipes and numbers
 
# Edit to replace commas with pipes and numbers
Line 169: Line 171:
 
<pre>
 
<pre>
 
<nowiki>
 
<nowiki>
{{cladex
+
{{clade
  |1={{cladex
+
  |1={{clade
 
     |1=a
 
     |1=a
 
     |2=b
 
     |2=b
 
     }}
 
     }}
  |2={{cladex
+
  |2={{clade
 
     |1=c
 
     |1=c
 
     |2=d
 
     |2=d
Line 195: Line 197:
 
s/(\t+)/$1\t/g for @branches;
 
s/(\t+)/$1\t/g for @branches;
 
die 'ERROR: degenerate/empty node!'.N if $#branches<1;
 
die 'ERROR: degenerate/empty node!'.N if $#branches<1;
$tree=~ s/\(\Q$clade\E\)/${\join('','{{cladex',N,map(T.'|'.($_+1).'='.$branches[$_].N,0..$#branches),T.'}}')}/; # substitute
+
$tree=~ s/\(\Q$clade\E\)/${\join('','{{clade',N,map(T.'|'.($_+1).'='.$branches[$_].N,0..$#branches),T.'}}')}/; # substitute
 
}
 
}
 
pos($tree)=0;
 
pos($tree)=0;
Line 212: Line 214:
 
{{cladogram|title=Example
 
{{cladogram|title=Example
 
|caption=Sample of Template:Cladogram
 
|caption=Sample of Template:Cladogram
|clades={{cladex| style=font-size:75%;line-height:75%
+
|clades={{clade| style=font-size:75%;line-height:75%
 
|label1=[[Neornithes]]&nbsp;&nbsp;
 
|label1=[[Neornithes]]&nbsp;&nbsp;
|1={{cladex
+
|1={{clade
 
|label1=[[Paleognathae]]
 
|label1=[[Paleognathae]]
 
|1=&nbsp;
 
|1=&nbsp;
 
|label2=&nbsp;[[Neognathae]]&nbsp;
 
|label2=&nbsp;[[Neognathae]]&nbsp;
|2={{cladex
+
|2={{clade
 
  |1=Other birds
 
  |1=Other birds
 
  |label1=&nbsp;
 
  |label1=&nbsp;
 
  |label2=[[Galloanserae]]&nbsp;
 
  |label2=[[Galloanserae]]&nbsp;
  |2={{cladex
+
  |2={{clade
 
      |1=[[Anseriformes]]
 
      |1=[[Anseriformes]]
 
  |label2=&nbsp;&nbsp;&nbsp;&nbsp;
 
  |label2=&nbsp;&nbsp;&nbsp;&nbsp;
  |2={{cladex
+
  |2={{clade
 
      |1=[[Galliformes]]
 
      |1=[[Galliformes]]
 
      |2=[[Craciformes]]
 
      |2=[[Craciformes]]
Line 236: Line 238:
 
{{cladogram|title=Example
 
{{cladogram|title=Example
 
|caption=Sample of Template:Cladogram
 
|caption=Sample of Template:Cladogram
|clades={{cladex| style=font-size:75%;line-height:75%
+
|clades={{clade| style=font-size:75%;line-height:75%
 
|label1=[[Neornithes]]&nbsp;&nbsp;
 
|label1=[[Neornithes]]&nbsp;&nbsp;
|1={{cladex
+
|1={{clade
 
|label1=[[Paleognathae]]
 
|label1=[[Paleognathae]]
 
|1=&nbsp;
 
|1=&nbsp;
 
|label2=&nbsp;[[Neognathae]]&nbsp;
 
|label2=&nbsp;[[Neognathae]]&nbsp;
|2={{cladex
+
|2={{clade
 
  |1=Other birds
 
  |1=Other birds
 
  |label1=&nbsp;
 
  |label1=&nbsp;
 
  |label2=[[Galloanserae]]&nbsp;
 
  |label2=[[Galloanserae]]&nbsp;
  |2={{cladex
+
  |2={{clade
 
      |1=[[Anseriformes]]
 
      |1=[[Anseriformes]]
 
  |label2=&nbsp;&nbsp;&nbsp;&nbsp;
 
  |label2=&nbsp;&nbsp;&nbsp;&nbsp;
  |2={{cladex
+
  |2={{clade
 
      |1=[[Galliformes]]
 
      |1=[[Galliformes]]
 
      |2=[[Craciformes]]
 
      |2=[[Craciformes]]
Line 263: Line 265:
  
 
To insert a coloured 'bracket' around a set of leaf nodes which follow one another in the generated cladogram:
 
To insert a coloured 'bracket' around a set of leaf nodes which follow one another in the generated cladogram:
* Add <tt>barbeginN=''colour''</tt> for the first node, where N is its order as a child and ''colour'' is the required colour.
+
* Add <tt>barbeginN=''colour''</tt> for the first leaf node, where N is the order of that leaf node within ''its'' clade, and ''colour'' is the required colour.
* Add <tt>barN=''colour''</tt> for the remaining nodes other than the last (note that N must be the order of that node as a child of its parent).
+
* Add <tt>barN=''colour''</tt> for the remaining nodes other than the last (note that N must be the order of that node within ''its'' clade).
 
* Add <tt>barendN=''colour''</tt> for the last node.
 
* Add <tt>barendN=''colour''</tt> for the last node.
 +
 +
Either the outermost clade must be specified by {{tl|clade}} or if {{tl|cladex}} is needed there, <tt>|style=width:auto</tt> must be present.
  
 
<pre>
 
<pre>
 
<nowiki>
 
<nowiki>
{{cladex
+
{{clade
 
|1={{cladex
 
|1={{cladex
 
   |1=Leaf A
 
   |1=Leaf A
Line 289: Line 293:
  
 
produces
 
produces
{{cladex
+
{{clade
 
|1={{cladex
 
|1={{cladex
 
   |1=Leaf A
 
   |1=Leaf A
Line 306: Line 310:
 
}}
 
}}
  
The horizontal lines can be omitted by using <tt>|barN=''colour''</tt> throughout. Thus
+
The horizontal lines can be omitted by using <tt>|barN=''colour''</tt> throughout. Thus the following (note the use of <tt>|style=width:auto</tt> since the outermost clade uses the extra features of {{tl|cladex}}):
  
 
<pre>
 
<pre>
 
<nowiki>
 
<nowiki>
{{cladex
+
{{cladex|style=width:auto
 
|1=Leaf A
 
|1=Leaf A
 
|2={{cladex
 
|2={{cladex
Line 321: Line 325:
  
 
produces
 
produces
{{cladex
+
{{cladex|style=width:auto
 
|1=Leaf A
 
|1=Leaf A
 
|2={{cladex
 
|2={{cladex
Line 334: Line 338:
 
<pre>
 
<pre>
 
<nowiki>
 
<nowiki>
{{cladex
+
{{clade
 
|1=Leaf A
 
|1=Leaf A
 
|bar2=midnightblue
 
|bar2=midnightblue
Line 351: Line 355:
 
You can use any of the ways in which colours can be specified in HTML; e.g. the standard [http://www.w3schools.com/html/html_colornames.asp colour names], the three or six hex digit notations, such as #FC3 or #F3C630, or the <tt>rgb()</tt> notation.
 
You can use any of the ways in which colours can be specified in HTML; e.g. the standard [http://www.w3schools.com/html/html_colornames.asp colour names], the three or six hex digit notations, such as #FC3 or #F3C630, or the <tt>rgb()</tt> notation.
  
===Limitations, work-arounds===
+
===Limitations, debugging===
  
 
{{tl|Cladex}} like {{tl|Clade}} uses the browser's (user agent's) algorithms for drawing tables. As these differ from browser to browser, the cladograms produced will not look the same on all browsers.
 
{{tl|Cladex}} like {{tl|Clade}} uses the browser's (user agent's) algorithms for drawing tables. As these differ from browser to browser, the cladograms produced will not look the same on all browsers.
  
{{tl|Cladex}} is at the very limits of what is possible using table drawing algorithms to produce cladograms. In some cases, extra space has to be added to the name of one of the leaves. Consider the following example. (Note the use of {{tl|Clade}} for the clades which don't have any brackets/bars.)
+
{{tl|Cladex}} is probably close to the limits of what is possible using table drawing algorithms to produce cladograms. The vertical bar is always drawn at the very right-hand edge of the underlying table which {{tl|Cladex}} and {{tl|Clade}} produce, which is often not how it would be drawn manually. {{As of|2011|June|21}}, there is no known way round this.
<pre>
 
<nowiki>
 
{{clade
 
|1={{clade
 
  |1=Leaf A
 
  |2={{cladex
 
      |1=Leaf B|barbegin1=purple
 
      |2={{cladex
 
        |1=Leaf C|bar1=purple
 
        |2={{cladex
 
            |1=Leaf E|barend1=purple
 
            |2=Leaf F
 
            }}
 
        }}
 
      }}
 
  }}
 
}}</nowiki>
 
</pre>
 
This produces
 
{{clade
 
|1={{clade
 
  |1=Leaf A
 
  |2={{cladex
 
      |1=Leaf B|barbegin1=purple
 
      |2={{cladex
 
        |1=Leaf C|bar1=purple
 
        |2={{cladex
 
            |1=Leaf E|barend1=purple
 
            |2=Leaf F
 
            }}
 
        }}
 
      }}
 
  }}
 
}}
 
However, if the name of either Leaf B or Leaf C is sufficiently long so that it extends beyond the end of the name of Leaf E, the bar is not drawn correctly:
 
{{clade
 
|1={{clade
 
  |1=Leaf A
 
  |2={{cladex
 
      |1=Leaf B|barbegin1=purple
 
      |2={{cladex
 
        |1=Leaf C with a long name|bar1=purple
 
        |2={{cladex
 
            |1=Leaf E|barend1=purple
 
            |2=Leaf F
 
            }}
 
        }}
 
      }}
 
  }}
 
}}
 
The work-around is that the name of the leaf which would be furthest to the right if all the names were of equal length must be padded, e.g. by adding repeats of <tt>&amp;nbsp;</tt>. In this case, 22 repetitions of <tt>&amp;nbsp;</tt> after "Leaf E" produced the following cladogram.
 
{{clade
 
|1={{clade
 
  |1=Leaf A
 
  |2={{cladex
 
      |1=Leaf B|barbegin1=purple
 
      |2={{cladex
 
        |1=Leaf C with a long name|bar1=purple
 
        |2={{cladex
 
            |1=Leaf E&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|barend1=purple
 
            |2=Leaf F
 
            }}
 
        }}
 
      }}
 
  }}
 
}}
 
(An alternative technique is to pad out the name of this leaf to make it the same length as the longest by adding hidden text, using e.g. <tt>Leaf E<nowiki><span style="visibility:hidden"> with a long name</span></nowiki><tt>.)
 
  
{{tl|Cladex}} does ''not'' work if the bracket or bar includes a clade other than at the very beginning or end of the bracket or bar. Thus the following does not display correctly.
+
If your cladogram doesn't display brackets/bars as you expected, check that:
<pre>
+
* You understand the numbering system for the parameters <tt>barN<tt>, etc. The N must be the same as the number of the child within the clade. Thus typically you should write <tt>N=''label for leaf''|barN=''colour for bar''<tt>.
<nowiki>
+
* You have only attempted to apply brackets/bars to ''leaf'' nodes.
{{clade
+
* Either the outermost clade uses {{tl|Clade}} or if it has to use {{tl|Cladex}}, then <tt>|style=width:auto</tt> is present.
|1={{clade
 
  |1=Leaf A
 
  |2={{cladex
 
      |1=Leaf B|barbegin1=purple
 
      |2={{cladex
 
        |1={{cladex
 
            |1=Leaf C1|bar1=purple
 
            |2=Leaf C2|bar1=purple
 
            }}
 
        |2={{cladex
 
            |1=Leaf E has a long name|barend1=purple
 
            |2=Leaf F
 
            }}
 
        }}
 
      }}
 
  }}
 
}}</nowiki>
 
</pre>
 
{{clade
 
|1={{clade
 
  |1=Leaf A
 
  |2={{cladex
 
      |1=Leaf B|barbegin1=purple
 
      |2={{cladex
 
        |1={{cladex
 
            |1=Leaf C1|bar1=purple
 
            |2=Leaf C2|bar2=purple
 
            }}
 
        |2={{cladex
 
            |1=Leaf E has a long name|barend1=purple
 
            |2=Leaf F
 
            }}
 
        }}
 
      }}
 
  }}
 
}}
 
{{As of|2011|June|21}}, there is no reliable work-around for this issue. (Adding repetitions of <tt>&amp;nbsp;</tt> to e.g. "Leaf C2" may appear to make the bars line up for one particular font and font size, but this does not work more generally.)
 
  
 
==Size limitations==
 
==Size limitations==

Revision as of 15:21, 21 June 2011

This template is an eXtended version of {{Clade}}, hence the name. Both templates are for drawing branching trees with the nodes and base labels being clickable links. Such diagrams are especially suited to represent evolutionary trees.

Most of the documentation is the same as the parent template, {{Clade}}, and is included below for convenience. Unless the two extra features of {{Cladex}} are needed, you are advised to use {{Clade}}.

The two extra features of {{Cladex}} are:

  • Double lines leading to a node can be used 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. See #Bracketting nodes.

{{Clade}} and {{Cladex}} can be freely mixed, so if only some clades requires either of the extra features, only these need be specified using {{Cladex}}.

Basic features

Use {{Clade}} unless the extra features of {tl|Cladex}} are needed.

Usage


{{clade
|label1=Base
|1=Node
}}

produces

Base

Node


{{clade
|1={{clade
   |label1=[[Subtree1]]
   |1=Leaf1
   |label2=Subtree2
   |2=[[Leaf2]]
   }}
}}

produces

Subtree1 

Leaf1

Subtree2 

Leaf2


{{clade| style=font-size:75%;line-height:75%
|1={{clade
   |label1=Subtree1
   |1=Leaf1
   |label2=Subtree2
   |2=Leaf2
   }}
}}

produces

Subtree1

Leaf1

Subtree2

Leaf2


{{clade
|1={{clade
   |1={{clade | thickness=3
      |1=Leaf1
      |2=Leaf2
      }}
   |2=Leaf3
   }}
}}

produces

Leaf1

Leaf2

Leaf3

To replace the solid line with a dashed line, use |stateN=dashed.


{{clade
|1={{clade
   |1={{clade
      |1=Leaf1|state1=dashed
      |2=Leaf2
      }}
   |2=Leaf3
   }}
}}

produces

Leaf1

Leaf2

Leaf3

{{Cladex}} only. To replace a single line leading to the Nth child by a double line, use |stateN=double. Notice that {{cladex}} has only been used for the (sub)clade where the double line is wanted. The outermost clade should always be specified with {tl|clade}} unless its style is altered – see below.


{{clade
|1={{clade
   |1={{cladex
      |1=Leaf1
      |2=Leaf2|state2=double
      }}
   |2=Leaf3
   }}
}}

produces

Leaf1

Leaf2

Leaf3

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 "{{clade|"
  3. Replace ")" with "}}"
  4. Edit to replace commas with pipes and numbers
  5. Edit clade labels if needed

{{clade
 |1={{clade
    |1=a
    |2=b
    }}
 |2={{clade
    |1=c
    |2=d
    }}
}}

Example Perl script to automate the conversion:

use constant N=>"\n";
use constant T=>"\t";

my $tree='((a,b),(c,d));'; # get sequence
$tree=~s/[\n\r]//g; # loose those spaces
$tree=~ s/\:[\.\d]+//g; # loose those lengths
while ($tree=~ m/\(/) {
	foreach my $clade ($tree=~ m/\(([^\(\)]+)\)/g) {
		my @branches=split /\,/,$clade;
		s/(\t+)/$1\t/g for @branches;
		die 'ERROR: degenerate/empty node!'.N if $#branches<1;
		$tree=~ s/\(\Q$clade\E\)/${\join('','{{clade',N,map(T.'|'.($_+1).'='.$branches[$_].N,0..$#branches),T.'}}')}/; # substitute
	}
	pos($tree)=0;
}
$tree=~s/(\t*)\t\}\}/$1\}\}/g; # lazy fix

print $tree;

Using a box

You can nest the templates and use links around the text. You may use non-breaking spaces (&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. Use within Template:Cladogram.

Example
Neornithes  
Paleognathae

 

 Neognathae 
 

Other birds

Galloanserae 

Anseriformes

    

Galliformes

Craciformes

Sample of Template:Cladogram
{{cladogram|title=Example
|caption=Sample of Template:Cladogram
|clades={{clade| style=font-size:75%;line-height:75%
|label1=[[Neornithes]]  
|1={{clade
	|label1=[[Paleognathae]]
	|1= 
	|label2= [[Neognathae]] 
	|2={{clade
	   |1=Other birds
	   |label1= 
	   |label2=[[Galloanserae]] 
	   |2={{clade
	       |1=[[Anseriformes]]
		   |label2=    
		   |2={{clade
		      |1=[[Galliformes]]
		      |2=[[Craciformes]]
		      }}
	      }}
	   }}
       }}
  }}
}}

Bracketting nodes

{{Cladex}} only.

To insert a coloured 'bracket' around a set of leaf nodes which follow one another in the generated cladogram:

  • Add barbeginN=colour for the first leaf node, where N is the order of that leaf node within its clade, and colour is the required colour.
  • Add barN=colour for the remaining nodes other than the last (note that N must be the order of that node within its clade).
  • Add barendN=colour for the last node.

Either the outermost clade must be specified by {{clade}} or if {{cladex}} is needed there, |style=width:auto must be present.


{{clade
|1={{cladex
   |1=Leaf A
   |2=Leaf B|barbegin2=green
   |3=Leaf C|bar3=green
   |4={{cladex
      |1=Leaf D|barend1=green
      |2=Leaf E
      |3=Leaf F|barbegin3=purple  
      |4={{cladex
         |1=Leaf G|bar1=purple
         |2=Leaf H|barend2=purple
         }}
      }}
   }}
}}

produces

Leaf A

Leaf B

Leaf C

Leaf D

Leaf E

Leaf F

Leaf G

Leaf H

The horizontal lines can be omitted by using |barN=colour throughout. Thus the following (note the use of |style=width:auto since the outermost clade uses the extra features of {{cladex}}):


{{cladex|style=width:auto
|1=Leaf A
|2={{cladex
   |1=Leaf B|bar1=midnightblue
   |2=Leaf C|bar2=midnightblue
   }}
|3=Leaf D|bar3=midnightblue 
}}

produces

Leaf A

Leaf B

Leaf C

Leaf D

Note that brackets or bars must only be applied to leaf nodes. In the example above, it may be tempting to write


{{clade
|1=Leaf A
|bar2=midnightblue
|2={{cladex
   |1=Leaf B
   |2=Leaf C
   }}
|3=Leaf D|bar3=midnightblue
}}

with the expectation that the bar will be to the right of the whole of the clade containing Leaf B and Leaf C. This does not work!

Specifying colours

You can use any of the ways in which colours can be specified in HTML; e.g. the standard colour names, the three or six hex digit notations, such as #FC3 or #F3C630, or the rgb() notation.

Limitations, debugging

{{Cladex}} like {{Clade}} uses the browser's (user agent's) algorithms for drawing tables. As these differ from browser to browser, the cladograms produced will not look the same on all browsers.

{{Cladex}} is probably close to the limits of what is possible using table drawing algorithms to produce cladograms. The vertical bar is always drawn at the very right-hand edge of the underlying table which {{Cladex}} and {{Clade}} produce, which is often not how it would be drawn manually. As of 21 June 2011, there is no known way round this.

If your cladogram doesn't display brackets/bars as you expected, check that:

  • You understand the numbering system for the parameters barN, etc. The N must be the same as the number of the child within the clade. Thus typically you should write N=label for leaf|barN=colour for bar.
  • You have only attempted to apply brackets/bars to leaf nodes.
  • Either the outermost clade uses {{Clade}} or if it has to use {{Cladex}}, then |style=width:auto is present.

Size limitations

Both {{Clade}} and {{Cladex}} have some size limitations.

  • Both currently allow only a maximum of 17 children per node. It may seem that this could easily be increased by editing the templates, but see the next point.
  • Both will only expand a cladogram up to a certain level of complexity. The cladogram at APG_III_system#Phylogeny has had to be broken into two parts, because {{Clade}} will not handle the entire cladogram. Because {{Cladex}} has more complex internal code, it runs out of the allowed resources for template expansion sooner, and will only handle templates which are slightly smaller. Any change to either of these templates could result in larger cladograms failing to display correctly.