Skip to content

Python package to plot a phylogenetic tree on an existing matplotlib axis.

License

Notifications You must be signed in to change notification settings

KatyBrown/plot_phylo

Repository files navigation

Tests Passing
Documentation Status
Project Status: Active – The project has reached a stable, usable state and is being actively developed.
Python Versions
PyPI - Version

plot_phylo

Illustration

This module allows the user to plot a phylogenetic tree on an existing matplotlib axis.

This means that:

  • Phylogenies can be incorporated into existing plots.
  • Annotations can be added using standard matplotlib functionality.
  • Plots can be output in png, pdf, svg or tiff formats.
  • Automatically generated and updated figures can include phylogenies

Full documentation is available via ReadTheDocs.

The module depends on the ETE Toolkit, an excellent existing Python framework for analysing and visualising phylogenetic trees, plus the matplotlib visualisation library. It is designed to make generating complex figures incorporating phylogenies easier, as matplotlib plotting functions can be used on top of the basic tree.

Installation

Requirements

  • python >= 3.6
  • matplotlib >= 2.1.1
  • ete3 >= 3.1.0

The module can be installed using pip

pip install plot_phylo

You can also download the latest release here

Or clone the GitHub repository directly.

git clone [email protected]:KatyBrown/plot_phylo.git

Quick Start

For detailed usage instructions, visit our ReadTheDocs page.

To draw a phylogeny under the default settings onto a blank figure.

import matplotlib.pyplot as plt
import plot_phylo

# Create an empty plot, 8in (width) by 10in (height) - matplotlib
f = plt.figure(figsize=(8, 10))

# Add an axis - matplotlib
ax = plt.subplot()

# Plot the tree on this axis, using the default settings - plot_phylo
results = plot_phylo.plot_phylo("examples/primates.nw", ax)

# Save the tree - matplotlib
plt.savefig("examples/basic_plot.png", bbox_inches='tight')

Cite

If you use this repository in your work, please cite:

Brown, K (2024) plot_phylo. https://github.com/KatyBrown/plot_phylo

Continuous Integration

I use GitHub Actions for continuous integration to ensure code quality. You can view the configuration here.

About

Python package to plot a phylogenetic tree on an existing matplotlib axis.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages