iplotx 0.0.1__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {iplotx-0.0.1 → iplotx-0.2.0}/.github/workflows/test.yml +2 -2
- {iplotx-0.0.1 → iplotx-0.2.0}/.gitignore +5 -1
- iplotx-0.2.0/.readthedocs.yaml +25 -0
- {iplotx-0.0.1 → iplotx-0.2.0}/PKG-INFO +40 -8
- iplotx-0.2.0/README.md +46 -0
- iplotx-0.2.0/docs/Makefile +20 -0
- iplotx-0.2.0/docs/make.bat +35 -0
- iplotx-0.2.0/docs/source/_static/graph_basic.png +0 -0
- iplotx-0.2.0/docs/source/_templates/layout.html +9 -0
- iplotx-0.2.0/docs/source/api.md +60 -0
- iplotx-0.2.0/docs/source/conf.py +139 -0
- iplotx-0.2.0/docs/source/images/sphx_glr_plot_basic_001.png +0 -0
- iplotx-0.2.0/docs/source/images/thumb/sphx_glr_plot_basic_thumb.png +0 -0
- iplotx-0.2.0/docs/source/index.md +118 -0
- iplotx-0.2.0/docs/source/sg_execution_times.rst +124 -0
- iplotx-0.2.0/docs/source/style.md +185 -0
- iplotx-0.2.0/gallery/GALLERY_HEADER.rst +3 -0
- iplotx-0.2.0/gallery/chess_masters_WCC.pgn.bz2 +0 -0
- iplotx-0.2.0/gallery/knuth_miles.txt.gz +0 -0
- iplotx-0.2.0/gallery/plot_basic.py +15 -0
- iplotx-0.2.0/gallery/plot_big_curves.py +24 -0
- iplotx-0.2.0/gallery/plot_biopython_tree.py +60 -0
- iplotx-0.2.0/gallery/plot_chess_masters.py +150 -0
- iplotx-0.2.0/gallery/plot_cliques.py +83 -0
- iplotx-0.2.0/gallery/plot_cluster_layout.py +70 -0
- iplotx-0.2.0/gallery/plot_cogent3_tree.py +55 -0
- iplotx-0.2.0/gallery/plot_complex.py +51 -0
- iplotx-0.2.0/gallery/plot_dag.py +37 -0
- iplotx-0.2.0/gallery/plot_directed.py +15 -0
- iplotx-0.2.0/gallery/plot_ete4.py +39 -0
- iplotx-0.2.0/gallery/plot_four_grids.py +87 -0
- iplotx-0.2.0/gallery/plot_grouping.py +92 -0
- iplotx-0.2.0/gallery/plot_house.py +44 -0
- iplotx-0.2.0/gallery/plot_knuth_miles.py +130 -0
- iplotx-0.2.0/gallery/plot_labels_and_colors.py +76 -0
- iplotx-0.2.0/gallery/plot_loops.py +105 -0
- iplotx-0.2.0/gallery/plot_max_bipartite_matching.py +78 -0
- iplotx-0.2.0/gallery/plot_minimum_spanning_trees.py +75 -0
- iplotx-0.2.0/gallery/plot_multipartite_layout.py +51 -0
- iplotx-0.2.0/gallery/plot_parallel_igraph_networkx.py +23 -0
- iplotx-0.2.0/gallery/plot_ports.py +69 -0
- iplotx-0.2.0/gallery/plot_shortest_path.py +57 -0
- iplotx-0.2.0/gallery/plot_simple_networkx.py +46 -0
- iplotx-0.2.0/gallery/plot_simple_path.py +32 -0
- iplotx-0.2.0/gallery/plot_skbio_tree.py +39 -0
- iplotx-0.2.0/gallery/plot_style.py +29 -0
- iplotx-0.2.0/gallery/plot_traveling_salesman.py +74 -0
- iplotx-0.2.0/gallery/plot_voronoi.py +63 -0
- iplotx-0.2.0/gallery/plot_with_colorbar.py +119 -0
- iplotx-0.2.0/iplotx/__init__.py +23 -0
- iplotx-0.2.0/iplotx/edge/__init__.py +882 -0
- iplotx-0.2.0/iplotx/edge/arrow.py +332 -0
- iplotx-0.2.0/iplotx/edge/ports.py +42 -0
- iplotx-0.2.0/iplotx/groups.py +179 -0
- iplotx-0.2.0/iplotx/ingest/__init__.py +155 -0
- iplotx-0.2.0/iplotx/ingest/heuristics.py +209 -0
- iplotx-0.2.0/iplotx/ingest/providers/network/igraph.py +96 -0
- iplotx-0.2.0/iplotx/ingest/providers/network/networkx.py +133 -0
- iplotx-0.2.0/iplotx/ingest/providers/tree/biopython.py +105 -0
- iplotx-0.2.0/iplotx/ingest/providers/tree/cogent3.py +112 -0
- iplotx-0.2.0/iplotx/ingest/providers/tree/ete4.py +112 -0
- iplotx-0.2.0/iplotx/ingest/providers/tree/skbio.py +112 -0
- iplotx-0.2.0/iplotx/ingest/typing.py +100 -0
- iplotx-0.2.0/iplotx/label.py +127 -0
- iplotx-0.2.0/iplotx/layout.py +139 -0
- iplotx-0.2.0/iplotx/network.py +288 -0
- iplotx-0.2.0/iplotx/plotting.py +206 -0
- iplotx-0.2.0/iplotx/style.py +379 -0
- iplotx-0.2.0/iplotx/tree.py +285 -0
- iplotx-0.2.0/iplotx/typing.py +36 -0
- {iplotx-0.0.1 → iplotx-0.2.0}/iplotx/utils/geometry.py +128 -81
- iplotx-0.2.0/iplotx/utils/internal.py +3 -0
- {iplotx-0.0.1 → iplotx-0.2.0}/iplotx/utils/matplotlib.py +58 -38
- iplotx-0.2.0/iplotx/utils/style.py +1 -0
- iplotx-0.2.0/iplotx/version.py +5 -0
- iplotx-0.2.0/iplotx/vertex.py +307 -0
- {iplotx-0.0.1 → iplotx-0.2.0}/pyproject.toml +27 -5
- iplotx-0.2.0/tests/baseline_images/test_biopython/leaf_labels.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_biopython/leaf_labels_hmargin.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_biopython/tree_basic.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_biopython/tree_radial.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_cogent3/leaf_labels.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_cogent3/leaf_labels_hmargin.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_cogent3/tree_basic.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_cogent3/tree_radial.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_ete4/leaf_labels.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_ete4/leaf_labels_hmargin.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_ete4/tree_basic.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_ete4/tree_radial.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/clustering_directed.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/clustering_directed_large.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/graph_basic.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/graph_directed.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/graph_directed_curved_loops.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/graph_edit_children.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/graph_labels.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/graph_layout_attribute.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/graph_null.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/graph_squares_directed.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/igraph_layout_object.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_igraph/multigraph_with_curved_edges_undirected.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_networkx/cluster-layout.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_networkx/complex.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_networkx/directed_graph.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_networkx/directed_graph_with_colorbar.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_networkx/empty_graph.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_networkx/flat_style.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_networkx/house_with_colors.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_networkx/labels_and_colors.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_networkx/shortest_path.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_networkx/simple_graph.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_skbio/leaf_labels.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_skbio/leaf_labels_hmargin.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_skbio/tree_basic.png +0 -0
- iplotx-0.2.0/tests/baseline_images/test_skbio/tree_radial.png +0 -0
- iplotx-0.2.0/tests/test_biopython.py +85 -0
- iplotx-0.2.0/tests/test_cogent3.py +81 -0
- iplotx-0.2.0/tests/test_ete4.py +81 -0
- iplotx-0.2.0/tests/test_igraph.py +323 -0
- iplotx-0.2.0/tests/test_networkx.py +409 -0
- iplotx-0.2.0/tests/test_skbio.py +83 -0
- iplotx-0.2.0/tests/test_style.py +60 -0
- {iplotx-0.0.1 → iplotx-0.2.0}/tests/utils.py +2 -0
- {iplotx-0.0.1 → iplotx-0.2.0}/uv.lock +718 -231
- iplotx-0.0.1/README.md +0 -15
- iplotx-0.0.1/iplotx/__init__.py +0 -2
- iplotx-0.0.1/iplotx/edge/arrow.py +0 -122
- iplotx-0.0.1/iplotx/edge/common.py +0 -47
- iplotx-0.0.1/iplotx/edge/directed.py +0 -149
- iplotx-0.0.1/iplotx/edge/label.py +0 -50
- iplotx-0.0.1/iplotx/edge/undirected.py +0 -447
- iplotx-0.0.1/iplotx/groups.py +0 -141
- iplotx-0.0.1/iplotx/heuristics.py +0 -114
- iplotx-0.0.1/iplotx/importing.py +0 -13
- iplotx-0.0.1/iplotx/network.py +0 -507
- iplotx-0.0.1/iplotx/plotting.py +0 -104
- iplotx-0.0.1/iplotx/styles.py +0 -186
- iplotx-0.0.1/iplotx/typing.py +0 -41
- iplotx-0.0.1/iplotx/version.py +0 -1
- iplotx-0.0.1/iplotx/vertex.py +0 -112
- iplotx-0.0.1/tests/baseline_images/test_igraph/graph_basic.png +0 -0
- iplotx-0.0.1/tests/baseline_images/test_igraph/graph_directed.png +0 -0
- iplotx-0.0.1/tests/test_igraph.py +0 -291
- {iplotx-0.0.1 → iplotx-0.2.0}/.github/workflows/publish.yml +0 -0
- {iplotx-0.0.1 → iplotx-0.2.0}/LICENSE +0 -0
- {iplotx-0.0.1 → iplotx-0.2.0}/MANIFEST.in +0 -0
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
strategy:
|
|
17
17
|
fail-fast: false
|
|
18
18
|
matrix:
|
|
19
|
-
python-version: ["3.
|
|
19
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
20
20
|
|
|
21
21
|
steps:
|
|
22
22
|
- uses: actions/checkout@v4
|
|
@@ -38,4 +38,4 @@ jobs:
|
|
|
38
38
|
run: uv run pytest tests
|
|
39
39
|
|
|
40
40
|
- name: Run flake8
|
|
41
|
-
run: uv run flake8
|
|
41
|
+
run: uv run flake8 iplotx --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Read the Docs configuration file
|
|
2
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
3
|
+
|
|
4
|
+
# Required
|
|
5
|
+
version: 2
|
|
6
|
+
|
|
7
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
8
|
+
sphinx:
|
|
9
|
+
configuration: docs/source/conf.py
|
|
10
|
+
|
|
11
|
+
# Set the OS, Python version, and other tools you might need
|
|
12
|
+
build:
|
|
13
|
+
os: ubuntu-24.04
|
|
14
|
+
tools:
|
|
15
|
+
python: "3.13"
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
pre_create_environment:
|
|
19
|
+
- asdf plugin add uv
|
|
20
|
+
- asdf install uv latest
|
|
21
|
+
- asdf global uv latest
|
|
22
|
+
create_environment:
|
|
23
|
+
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
|
|
24
|
+
install:
|
|
25
|
+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: iplotx
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Plot networkx from igraph and networkx.
|
|
5
5
|
Project-URL: Homepage, https://github.com/fabilab/iplotx
|
|
6
6
|
Project-URL: Documentation, https://readthedocs.org/iplotx
|
|
@@ -14,29 +14,61 @@ Keywords: graph,network,plotting,visualisation
|
|
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
20
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
-
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Requires-Python: >=3.11
|
|
22
21
|
Requires-Dist: matplotlib>=2.0.0
|
|
22
|
+
Requires-Dist: numpy>=2.0.0
|
|
23
23
|
Requires-Dist: pandas>=2.0.0
|
|
24
|
+
Requires-Dist: pylint>=3.3.7
|
|
24
25
|
Provides-Extra: igraph
|
|
25
26
|
Requires-Dist: igraph>=0.11.0; extra == 'igraph'
|
|
26
27
|
Provides-Extra: networkx
|
|
27
28
|
Requires-Dist: networkx>=2.0.0; extra == 'networkx'
|
|
28
29
|
Description-Content-Type: text/markdown
|
|
29
30
|
|
|
31
|
+

|
|
32
|
+

|
|
33
|
+

|
|
34
|
+
|
|
30
35
|
# iplotx
|
|
31
36
|
Plotting networks from igraph and networkx.
|
|
32
37
|
|
|
33
|
-
**NOTE**: This is currently
|
|
38
|
+
**NOTE**: This is currently alpha quality software. The API and functionality will break constantly, so use at your own risk. That said, if you have things you would like to see improved, please open a GitHub issue.
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
```bash
|
|
42
|
+
pip install iplotx
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
```python
|
|
47
|
+
import networkx as nx
|
|
48
|
+
import matplotlib.pyplot as plt
|
|
49
|
+
import iplotx as ipx
|
|
50
|
+
|
|
51
|
+
g = nx.Graph([(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)])
|
|
52
|
+
layout = nx.layout.circular_layout(g)
|
|
53
|
+
fig, ax = plt.subplots(figsize=(3, 3))
|
|
54
|
+
ipx.plot(g, ax=ax, layout=layout)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
## Documentation
|
|
60
|
+
See [readthedocs](https://iplotx.readthedocs.io/en/latest/) for the full documentation.
|
|
61
|
+
|
|
62
|
+
## Gallery
|
|
63
|
+
See [gallery](https://iplotx.readthedocs.io/en/latest/gallery/index.html).
|
|
34
64
|
|
|
35
65
|
## Roadmap
|
|
36
66
|
- Plot networks from igraph and networkx interchangeably, using matplotlib as a backend. ✅
|
|
37
67
|
- Support interactive plotting, e.g. zooming and panning after the plot is created. ✅
|
|
38
|
-
- Support storing the plot to disk thanks to the many matplotlib backends (SVG, PNG, PDF, etc.).
|
|
39
|
-
-
|
|
68
|
+
- Support storing the plot to disk thanks to the many matplotlib backends (SVG, PNG, PDF, etc.). ✅
|
|
69
|
+
- Support flexible yet easy styling. ✅
|
|
70
|
+
- Efficient plotting of large graphs using matplotlib's collection functionality. ✅
|
|
71
|
+
- Support trees from special libraries such as ete3, biopython, etc. This will need a dedicated function and layouting. ✅
|
|
40
72
|
- Support animations, e.g. showing the evolution of a network over time. 🏗️
|
|
41
73
|
- Support uni- and bi-directional communication between graph object and plot object.🏗️
|
|
42
74
|
|
iplotx-0.2.0/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
# iplotx
|
|
6
|
+
Plotting networks from igraph and networkx.
|
|
7
|
+
|
|
8
|
+
**NOTE**: This is currently alpha quality software. The API and functionality will break constantly, so use at your own risk. That said, if you have things you would like to see improved, please open a GitHub issue.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
```bash
|
|
12
|
+
pip install iplotx
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
```python
|
|
17
|
+
import networkx as nx
|
|
18
|
+
import matplotlib.pyplot as plt
|
|
19
|
+
import iplotx as ipx
|
|
20
|
+
|
|
21
|
+
g = nx.Graph([(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)])
|
|
22
|
+
layout = nx.layout.circular_layout(g)
|
|
23
|
+
fig, ax = plt.subplots(figsize=(3, 3))
|
|
24
|
+
ipx.plot(g, ax=ax, layout=layout)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
30
|
+
See [readthedocs](https://iplotx.readthedocs.io/en/latest/) for the full documentation.
|
|
31
|
+
|
|
32
|
+
## Gallery
|
|
33
|
+
See [gallery](https://iplotx.readthedocs.io/en/latest/gallery/index.html).
|
|
34
|
+
|
|
35
|
+
## Roadmap
|
|
36
|
+
- Plot networks from igraph and networkx interchangeably, using matplotlib as a backend. ✅
|
|
37
|
+
- Support interactive plotting, e.g. zooming and panning after the plot is created. ✅
|
|
38
|
+
- Support storing the plot to disk thanks to the many matplotlib backends (SVG, PNG, PDF, etc.). ✅
|
|
39
|
+
- Support flexible yet easy styling. ✅
|
|
40
|
+
- Efficient plotting of large graphs using matplotlib's collection functionality. ✅
|
|
41
|
+
- Support trees from special libraries such as ete3, biopython, etc. This will need a dedicated function and layouting. ✅
|
|
42
|
+
- Support animations, e.g. showing the evolution of a network over time. 🏗️
|
|
43
|
+
- Support uni- and bi-directional communication between graph object and plot object.🏗️
|
|
44
|
+
|
|
45
|
+
## Authors
|
|
46
|
+
Fabio Zanini (https://fabilab.org)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{% extends '!layout.html' %}
|
|
2
|
+
{% block extrahead %}
|
|
3
|
+
{{super()}}
|
|
4
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css" />
|
|
5
|
+
{% endblock %}
|
|
6
|
+
{% block document %}
|
|
7
|
+
{{super()}}
|
|
8
|
+
<a class="github-fork-ribbon" href="https://github.com/fabilab/iplotx" data-ribbon="Fork me on GitHub" title="Fork me on GitHub">Fork me on GitHub</a>
|
|
9
|
+
{% endblock %}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Reference API
|
|
2
|
+
This is the reference documentation for `iplotx`.
|
|
3
|
+
|
|
4
|
+
## Main functions
|
|
5
|
+
The main user-facing function is `iplotx.network`, which can be used to plot graphs and graph groupings (covers and clusterings), and `iplotx.tree` to plot trees. `iplotx.plot` is a synonym for `iplotx.network`.
|
|
6
|
+
|
|
7
|
+
```{eval-rst}
|
|
8
|
+
.. autofunction:: iplotx.network
|
|
9
|
+
:noindex:
|
|
10
|
+
|
|
11
|
+
.. autofunction:: iplotx.tree
|
|
12
|
+
:noindex:
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Styling
|
|
16
|
+
See also the <project:style.md> for an introduction to styles in `iplotx`.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
```{eval-rst}
|
|
20
|
+
.. autofunction:: iplotx.style.context
|
|
21
|
+
|
|
22
|
+
.. autofunction:: iplotx.style.use
|
|
23
|
+
|
|
24
|
+
.. autofunction:: iplotx.style.reset
|
|
25
|
+
|
|
26
|
+
.. autofunction:: iplotx.style.get_style
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The following functions are reported for completeness but are rarely used by users directly:
|
|
30
|
+
|
|
31
|
+
```{eval-rst}
|
|
32
|
+
.. autofunction:: iplotx.style.unflatten_style
|
|
33
|
+
|
|
34
|
+
.. autofunction:: iplotx.style.rotate_style
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Artist hierarchy
|
|
38
|
+
`iplotx.plot` return a list of `matplotlib` artists (1 or 2). When a network is plotted, the first artist is an instance of `iplotx.NetworkArtist`. This class contains the visual elements representing vertices, edges, labels, arrows, etc. and can be used to further edit the plot after `iplotx.plot` returned.
|
|
39
|
+
|
|
40
|
+
A `NetworkArtist` instance has two notable properties: vertices and edges, which are instances of `VertexCollection` and `EdgeCollection`, respectively. These collections are `matplotlib` artists that can be used to modify the appearance of vertices and edges after the plot has been created.
|
|
41
|
+
|
|
42
|
+
In turn, a `VertexCollection` or `EdgeCollection` instance **may** contain a `LabelCollection` instance if the plot includes labels. Moreover, an `EdgeCollection` instance **may** contain an `EdgeArrowCollection` instance if the graph is directed.
|
|
43
|
+
|
|
44
|
+
```{eval-rst}
|
|
45
|
+
.. autoclass:: iplotx.network.NetworkArtist
|
|
46
|
+
:members:
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
.. autoclass:: iplotx.vertex.VertexCollection
|
|
50
|
+
:members:
|
|
51
|
+
|
|
52
|
+
.. autoclass:: iplotx.edge.EdgeCollection
|
|
53
|
+
:members:
|
|
54
|
+
|
|
55
|
+
.. autoclass:: iplotx.label.LabelCollection
|
|
56
|
+
:members:
|
|
57
|
+
|
|
58
|
+
.. autoclass:: iplotx.edge.arrow.EdgeArrowCollection
|
|
59
|
+
:members:
|
|
60
|
+
```
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
import sys
|
|
6
|
+
import os
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from packaging.version import parse as parse_version
|
|
9
|
+
|
|
10
|
+
import iplotx
|
|
11
|
+
|
|
12
|
+
# -- Project information -----------------------------------------------------
|
|
13
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
14
|
+
|
|
15
|
+
project = "iplotx"
|
|
16
|
+
copyright = "2025-%Y, Fabio Zanini"
|
|
17
|
+
author = "Fabio Zanini"
|
|
18
|
+
release = iplotx.__version__
|
|
19
|
+
|
|
20
|
+
# -- General configuration ---------------------------------------------------
|
|
21
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
22
|
+
|
|
23
|
+
extensions = [
|
|
24
|
+
"sphinx.ext.autodoc",
|
|
25
|
+
"sphinx.ext.napoleon",
|
|
26
|
+
"myst_parser",
|
|
27
|
+
"sphinx_design",
|
|
28
|
+
"sphinx_gallery.gen_gallery",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
# Napoleon settings
|
|
32
|
+
napoleon_google_docstring = True
|
|
33
|
+
napoleon_numpy_docstring = False
|
|
34
|
+
napoleon_include_init_with_doc = False
|
|
35
|
+
napoleon_include_private_with_doc = False
|
|
36
|
+
napoleon_include_special_with_doc = True
|
|
37
|
+
napoleon_use_admonition_for_examples = False
|
|
38
|
+
napoleon_use_admonition_for_notes = False
|
|
39
|
+
napoleon_use_admonition_for_references = False
|
|
40
|
+
napoleon_use_ivar = False
|
|
41
|
+
napoleon_use_param = True
|
|
42
|
+
napoleon_use_rtype = True
|
|
43
|
+
napoleon_preprocess_types = False
|
|
44
|
+
napoleon_type_aliases = None
|
|
45
|
+
napoleon_attr_annotations = True
|
|
46
|
+
|
|
47
|
+
myst_enable_extensions = ["colon_fence"]
|
|
48
|
+
|
|
49
|
+
sphinx_gallery_conf = {
|
|
50
|
+
"examples_dirs": "../../gallery", # path to your example scripts
|
|
51
|
+
"gallery_dirs": "./gallery", # path to where to save gallery generated output
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
source_suffix = {
|
|
55
|
+
".rst": "restructuredtext",
|
|
56
|
+
".md": "markdown",
|
|
57
|
+
".myst": "markdown",
|
|
58
|
+
".txt": "markdown",
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
templates_path = ["_templates"]
|
|
63
|
+
exclude_patterns = []
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# -- Options for HTML output -------------------------------------------------
|
|
67
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
68
|
+
|
|
69
|
+
html_theme = "sphinx_rtd_theme"
|
|
70
|
+
html_static_path = ["_static"]
|
|
71
|
+
|
|
72
|
+
# -----------------------------------------------------------------------------
|
|
73
|
+
# Source code links (credit to the matplotlib project for this part)
|
|
74
|
+
# -----------------------------------------------------------------------------
|
|
75
|
+
link_github = True
|
|
76
|
+
# You can add build old with link_github = False
|
|
77
|
+
|
|
78
|
+
if link_github:
|
|
79
|
+
import inspect
|
|
80
|
+
|
|
81
|
+
extensions.append("sphinx.ext.linkcode")
|
|
82
|
+
|
|
83
|
+
def linkcode_resolve(domain, info):
|
|
84
|
+
"""
|
|
85
|
+
Determine the URL corresponding to Python object
|
|
86
|
+
"""
|
|
87
|
+
if domain != "py":
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
modname = info["module"]
|
|
91
|
+
fullname = info["fullname"]
|
|
92
|
+
|
|
93
|
+
submod = sys.modules.get(modname)
|
|
94
|
+
if submod is None:
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
obj = submod
|
|
98
|
+
for part in fullname.split("."):
|
|
99
|
+
try:
|
|
100
|
+
obj = getattr(obj, part)
|
|
101
|
+
except AttributeError:
|
|
102
|
+
return None
|
|
103
|
+
|
|
104
|
+
if inspect.isfunction(obj):
|
|
105
|
+
obj = inspect.unwrap(obj)
|
|
106
|
+
try:
|
|
107
|
+
fn = inspect.getsourcefile(obj)
|
|
108
|
+
except TypeError:
|
|
109
|
+
fn = None
|
|
110
|
+
if not fn or fn.endswith("__init__.py"):
|
|
111
|
+
try:
|
|
112
|
+
fn = inspect.getsourcefile(sys.modules[obj.__module__])
|
|
113
|
+
except (TypeError, AttributeError, KeyError):
|
|
114
|
+
fn = None
|
|
115
|
+
if not fn:
|
|
116
|
+
return None
|
|
117
|
+
|
|
118
|
+
try:
|
|
119
|
+
source, lineno = inspect.getsourcelines(obj)
|
|
120
|
+
except (OSError, TypeError):
|
|
121
|
+
lineno = None
|
|
122
|
+
|
|
123
|
+
linespec = f"#L{lineno:d}-L{lineno + len(source) - 1:d}" if lineno else ""
|
|
124
|
+
|
|
125
|
+
startdir = Path(iplotx.__file__).parent.parent
|
|
126
|
+
try:
|
|
127
|
+
fn = os.path.relpath(fn, start=startdir).replace(os.path.sep, "/")
|
|
128
|
+
except ValueError:
|
|
129
|
+
return None
|
|
130
|
+
|
|
131
|
+
if not fn.startswith("iplotx/"):
|
|
132
|
+
return None
|
|
133
|
+
|
|
134
|
+
version = parse_version(iplotx.__version__)
|
|
135
|
+
tag = "main" if version.is_devrelease else f"v{version.public}"
|
|
136
|
+
return "https://github.com/fabilab/iplotx/blob" f"/{tag}/{fn}{linespec}"
|
|
137
|
+
|
|
138
|
+
else:
|
|
139
|
+
extensions.append("sphinx.ext.viewcode")
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# iplotx documentation
|
|
2
|
+
|
|
3
|
+
`iplotx` is a Python library to display graphs, networks and trees using `matplotlib` as a backend. It supports multiple network analysis libraries including `networkx` and `igraph` for networks and `biopython`, `scikit-bio`, `cogent3`, and `ete4` for trees.
|
|
4
|
+
|
|
5
|
+
`iplotx` guarantees the **exact same visual appearance** independently of what library you used to construct the network/tree.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
```
|
|
9
|
+
pip install iplotx
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
::::{tab-set}
|
|
15
|
+
|
|
16
|
+
:::{tab-item} igraph
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
import igraph as ig
|
|
20
|
+
import matplotlib.pyplot as plt
|
|
21
|
+
import iplotx as ipx
|
|
22
|
+
|
|
23
|
+
g = ig.Graph.Ring(5)
|
|
24
|
+
layout = g.layout("circle").coords
|
|
25
|
+
fig, ax = plt.subplots(figsize=(3, 3))
|
|
26
|
+
ipx.plot(g, ax=ax, layout=layout)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
:::
|
|
32
|
+
|
|
33
|
+
:::{tab-item} networkx
|
|
34
|
+
```
|
|
35
|
+
import networkx as nx
|
|
36
|
+
import matplotlib.pyplot as plt
|
|
37
|
+
import iplotx as ipx
|
|
38
|
+
|
|
39
|
+
g = nx.Graph([(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)])
|
|
40
|
+
layout = nx.layout.circular_layout(g)
|
|
41
|
+
fig, ax = plt.subplots(figsize=(3, 3))
|
|
42
|
+
ipx.plot(g, ax=ax, layout=layout)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
:::
|
|
46
|
+
|
|
47
|
+
::::
|
|
48
|
+
|
|
49
|
+
Either way, the result is the same:
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
## Gallery
|
|
54
|
+
See <project:gallery/index.rst> for examples of plots made with `iplotx`. Feel free to suggest new examples on GitHub by opening a new issue or pull request!
|
|
55
|
+
|
|
56
|
+
## Features
|
|
57
|
+
```{important}
|
|
58
|
+
If you are the maintainer of a network/graph/tree analysis library and would like
|
|
59
|
+
to propose improvements or see support for it, please reach out with an issue/PR
|
|
60
|
+
on GitHub!
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`iplotx`'s features' include:
|
|
64
|
+
- per-edge and per-vertex styling using sequences or dictionaries
|
|
65
|
+
- labels
|
|
66
|
+
- arrows
|
|
67
|
+
- tunable offset for parallel (i.e. multi-) edges
|
|
68
|
+
- ports (a la Graphviz)
|
|
69
|
+
- curved edges and self-loops with controllable tension
|
|
70
|
+
- tree layouts
|
|
71
|
+
- label-based vertex autoscaling
|
|
72
|
+
- node label margins and padding
|
|
73
|
+
- export to many formats (e.g. PNG, SVG, PDF, EPS) thanks to `matplotlib`
|
|
74
|
+
- compatibility with many GUI frameworks (e.g. Qt, GTK, Tkinter) thanks to `matplotlib`
|
|
75
|
+
- data-driven axes autoscaling
|
|
76
|
+
- consistent behaviour upon zooming and panning
|
|
77
|
+
- correct HiDPI scaling (e.g. retina screens)
|
|
78
|
+
- a consistent `matplotlib` artist hierarchy
|
|
79
|
+
- post-plot editability (e.g. for animations)
|
|
80
|
+
- plays well with other charting tools (e.g. `seaborn`)
|
|
81
|
+
- chainable style contexts
|
|
82
|
+
- vertex clusterings and covers with convex hulls and rounding
|
|
83
|
+
- a plugin mechanism for additional libraries (WIP)
|
|
84
|
+
- ... and probably more by the time you read this.
|
|
85
|
+
|
|
86
|
+
## Styles
|
|
87
|
+
`iplotx` is designed to produce publication-quality figures using **styles**, which are dictionaries specifying the visual properties of each graph element, including vertices, edges, arrows, labels, and groupings.
|
|
88
|
+
|
|
89
|
+
An example of style specification is as follows:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
import iplotx as ipx
|
|
93
|
+
with ipx.style.context({
|
|
94
|
+
'vertex': {
|
|
95
|
+
'size': 30,
|
|
96
|
+
'facecolor': 'red',
|
|
97
|
+
'edgecolor': 'none',
|
|
98
|
+
}
|
|
99
|
+
}):
|
|
100
|
+
ipx.plot(...)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
See <project:style.md> for more info.
|
|
104
|
+
|
|
105
|
+
## Reference API
|
|
106
|
+
See <project:api.md> for reference documentation of all functions and classes in `iplotx`.
|
|
107
|
+
|
|
108
|
+
## Rationale
|
|
109
|
+
We believe graph **analysis**, graph **layouting**, and graph **visualisation** to be three separate tasks. `iplotx` currently focuses on visualisation. It can also compute simple tree layouts and might expand towards network layouts in the future.
|
|
110
|
+
|
|
111
|
+
```{toctree}
|
|
112
|
+
:maxdepth: 2
|
|
113
|
+
:caption: Contents
|
|
114
|
+
|
|
115
|
+
gallery/index
|
|
116
|
+
style
|
|
117
|
+
API <api>
|
|
118
|
+
```
|