[Biopython-dev] Enhancements to Phylo.draw; pyplot best practices

Eric Talevich eric.talevich at gmail.com
Sat Apr 7 18:42:02 UTC 2012


On Wed, Apr 4, 2012 at 10:53 PM, Eric Talevich <eric.talevich at gmail.com>wrote:

> Hi all,
>
> I'm considering some enhancements to the Phylo.draw function to make it
> more customizable for power users. Since the function is based on
> matplotlib/pylab/pyplot, it's possible for quite a bit to be left to the
> user; however, I'm not fully versed in what pyplot is capable of.
>
> Relevant feature request in Redmine:
> https://redmine.open-bio.org/issues/3336
>
> Ideas:

[...]
> 2. Add an argument 'branch_labels' to Phylo.draw. This will accept either
> (a) a dict which maps the tree's Clade objects to string labels, or (b) a
> function which accepts a Clade object and returns a string. Default: a
> function that formats the clade's 'confidence' or 'confidences' attribute,
> matching the current behavior.
>
> Examples:
> >>> draw(mytree, branch_labels={mytree.root: "Root", ...})
> >>> draw(mytree, branch_labels=lambda clade: "%d" % clade.confidence)
> >>> draw(mytree, branch_labels=lambda clade: clade.taxonomy.rank)
>
>
Just committed this feature:
https://github.com/biopython/biopython/commit/72990549a1b769ab19ab0bd33a8c35fdf031ac2d



More information about the Biopython-dev mailing list