Skip to main content

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

Project description

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 git@github.com: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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plot_phylo-0.1.11.tar.gz (14.2 kB view hashes)

Uploaded Source

Built Distribution

plot_phylo-0.1.11-py3-none-any.whl (14.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page