ढाँचा:Clade/कागजात
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.
Basic features
[सम्पादन गर्नुहोस्]Usage
[सम्पादन गर्नुहोस्]{{clade |label1=Base |1=Node }}
produces
Base |
Node |
{{clade |1={{clade |label1=[[Subtree1]] |1=Leaf1 |label2=Subtree2 |2=[[Leaf2]] }} }}
produces
| |||||||
{{clade| style=font-size:75%;line-height:75% |1={{clade |label1=Subtree1 |1=Leaf1 |label2=Subtree2 |2=Leaf2 }} }}
produces
| |||||||
Note that the order of the parameters does not matter. Exactly the same output is produced by
{{clade| style=font-size:75%;line-height:75% |1={{clade |2=Leaf2 |1=Leaf1 |label1=Subtree1 |label2=Subtree2 }} }}
| |||||||
{{clade |1={{clade |1={{clade | thickness=3 |1=Leaf1 |2=Leaf2 }} |2=Leaf3 }} }}
produces
| |||||||||||||
To replace a solid line leading to the Nth child with a dashed line, use |stateN=dashed.
{{clade |1={{clade |1={{clade |1=Leaf1|state1=dashed |2=Leaf2 }} |2=Leaf3 }} }}
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.
- Start with Newick format ((a,b),(c,d))
- Replace "(" with "{{clade|"
- Replace ")" with "}}"
- Edit to replace commas with pipes and numbers
- 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 ( ) 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 {{tl:Cladogram}} to produce the box.
Example | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Sample of {{tl:Cladogram}} |
{{cladogram|title=Example |caption=Sample of {{tl: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]] }} }} }} }} }} }}
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
{{clade |1=Sister1 |label2=Sister2 |2={{clade ... }} }}
use
{{clade |1=Sister1 |2={{clade |label1=Sister2 |2={{clade ... }} }} }}
Limitations
[सम्पादन गर्नुहोस्]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 not as actual spaces
- line breaks (i.e. <br>) 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#Phylogeny 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.