Visualise networks and trees in Python, with style.
Supports:
- networks:
- networkx
- igraph
- minimal network data structure (for educational purposes)
- trees:
- ETE4
- cogent3
- Biopython
- scikit-bio
- minimal tree data structure (for educational purposes)
In addition to the above, any network or tree analysis library can register an entry point to gain compatibility with iplotx
with no intervention from our side.
pip install iplotx
import networkx as nx
import matplotlib.pyplot as plt
import iplotx as ipx
g = nx.Graph([(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)])
layout = nx.layout.circular_layout(g)
fig, ax = plt.subplots(figsize=(3, 3))
ipx.plot(g, ax=ax, layout=layout)
See readthedocs for the full documentation.
See gallery.
- Plot networks from multiple libraries including networkx and igraph, using matplotlib as a backend. ✅
- Plot trees from multiple libraries such as cogent3, ETE4, skbio, and biopython. ✅
- Flexible yet easy styling, including an internal library of styles ✅
- Interactive plotting, e.g. zooming and panning after the plot is created. ✅
- Store the plot to disk thanks to the many matplotlib backends (SVG, PNG, PDF, etc.). ✅
- Efficient plotting of large graphs using matplotlib's collection functionality. ✅
- Edit plotting elements after the plot is created, e.g. changing node colors, labels, etc. ✅
- Animations, e.g. showing the evolution of a network over time. ✅
- Mouse and keyboard interaction, e.g. hovering over nodes/edges to get information about them. ✅
- Node clustering and covers, e.g. showing communities in a network. ✅
- Choice of tree layouts and orientations. ✅
- Tree-specific options: cascades, subtree styling, split edges, etc. ✅
- (WIP) Support uni- and bi-directional communication between graph object and plot object.🏗️
Fabio Zanini (https://fabilab.org)