This skill creates publication-quality phylogenetic tree figures using Bio.Phylo's matplotlib integration. It supports customizing labels, colors, and exporting to various image formats.
pip install biopython matplotlibTell your AI agent what you want to do:
- "Draw this Newick tree and save as PNG"
- "Create a publication-quality tree figure with bootstrap values"
- "Highlight the primate clade in red"
"Plot this tree with taxa labels"
"Show me an ASCII representation of this tree"
"Draw the tree and save as PDF"
"Add branch length labels to the tree"
"Show bootstrap support values at internal nodes"
"Make the tree figure taller to fit all labels"
"Color the human and chimp clades in red"
"Highlight clades with bootstrap > 90 in green"
"Save the tree as SVG for my publication"
"Export high-resolution PNG at 300 DPI"
- Read the tree file using Bio.Phylo
- Pre-process tree (ladderize, set missing lengths)
- Configure figure size based on number of taxa
- Apply requested customizations (colors, labels)
- Render tree using matplotlib
- Save to requested format
| Format | Best For |
|---|---|
| PNG | Presentations, web |
| Publications (vector) | |
| SVG | Web, editing in Illustrator |
- Always
ladderize()trees before drawing for cleaner appearance - Scale figure height with number of taxa (0.3 inches per taxon works well)
- Set
do_show=Falsewhen saving to file to avoid display issues - Convert to PhyloXML for better color support
- Use
bbox_inches='tight'when saving to avoid cropped labels