iplotx 0.2.1__tar.gz → 0.3.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.2.1 → iplotx-0.3.0}/.github/workflows/publish.yml +20 -7
- {iplotx-0.2.1 → iplotx-0.3.0}/PKG-INFO +2 -1
- {iplotx-0.2.1 → iplotx-0.3.0}/README.md +1 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/docs/source/index.md +3 -1
- {iplotx-0.2.1 → iplotx-0.3.0}/docs/source/sg_execution_times.rst +17 -5
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_biopython_tree.py +1 -0
- iplotx-0.3.0/gallery/plot_company_structure.py +72 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_edit_artists.py +1 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_ete4.py +15 -2
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_loops.py +4 -4
- iplotx-0.3.0/gallery/plot_mouse_hover.py +67 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_simple_path.py +2 -2
- iplotx-0.3.0/gallery/plot_tree_node_background.py +55 -0
- iplotx-0.3.0/gallery/plot_trees_of_trees.py +83 -0
- iplotx-0.3.0/iplotx/cascades.py +223 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/edge/__init__.py +20 -1
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/edge/geometry.py +72 -16
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/ingest/__init__.py +12 -4
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/ingest/heuristics.py +1 -3
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/ingest/providers/network/igraph.py +4 -2
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/ingest/providers/network/networkx.py +4 -2
- iplotx-0.3.0/iplotx/ingest/providers/tree/biopython.py +47 -0
- iplotx-0.3.0/iplotx/ingest/providers/tree/cogent3.py +41 -0
- iplotx-0.3.0/iplotx/ingest/providers/tree/ete4.py +44 -0
- iplotx-0.3.0/iplotx/ingest/providers/tree/skbio.py +41 -0
- iplotx-0.3.0/iplotx/ingest/typing.py +303 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/label.py +55 -8
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/layout.py +56 -35
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/plotting.py +6 -3
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/style.py +19 -5
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/tree.py +189 -8
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/version.py +1 -1
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/vertex.py +39 -7
- iplotx-0.3.0/tests/baseline_images/test_biopython/leaf_labels.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_biopython/leaf_labels_hmargin.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_biopython/tree_radial.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_cogent3/leaf_labels.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_cogent3/leaf_labels_hmargin.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_cogent3/tree_radial.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_ete4/leaf_labels.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_ete4/leaf_labels_hmargin.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_ete4/tree_radial.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_networkx/simple_graph.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_skbio/leaf_labels.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_skbio/leaf_labels_hmargin.png +0 -0
- iplotx-0.3.0/tests/baseline_images/test_skbio/tree_radial.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/test_biopython.py +1 -1
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/test_cogent3.py +1 -1
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/test_ete4.py +1 -1
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/test_igraph.py +2 -2
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/test_networkx.py +1 -1
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/test_skbio.py +1 -1
- iplotx-0.2.1/iplotx/ingest/providers/tree/biopython.py +0 -105
- iplotx-0.2.1/iplotx/ingest/providers/tree/cogent3.py +0 -112
- iplotx-0.2.1/iplotx/ingest/providers/tree/ete4.py +0 -112
- iplotx-0.2.1/iplotx/ingest/providers/tree/skbio.py +0 -112
- iplotx-0.2.1/iplotx/ingest/typing.py +0 -100
- iplotx-0.2.1/tests/baseline_images/test_biopython/leaf_labels.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_biopython/leaf_labels_hmargin.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_biopython/tree_radial.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_cogent3/leaf_labels.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_cogent3/leaf_labels_hmargin.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_cogent3/tree_radial.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_ete4/leaf_labels.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_ete4/leaf_labels_hmargin.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_ete4/tree_radial.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_networkx/simple_graph.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_skbio/leaf_labels.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_skbio/leaf_labels_hmargin.png +0 -0
- iplotx-0.2.1/tests/baseline_images/test_skbio/tree_radial.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/.github/workflows/test.yml +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/.gitignore +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/.readthedocs.yaml +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/LICENSE +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/MANIFEST.in +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/assets/pylint.svg +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/docs/Makefile +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/docs/make.bat +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/docs/source/_static/graph_basic.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/docs/source/_templates/layout.html +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/docs/source/api.md +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/docs/source/conf.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/docs/source/images/sphx_glr_plot_basic_001.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/docs/source/images/thumb/sphx_glr_plot_basic_thumb.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/docs/source/style.md +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/GALLERY_HEADER.rst +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/chess_masters_WCC.pgn.bz2 +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/knuth_miles.txt.gz +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_animation.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_basic.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_big_curves.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_chess_masters.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_cliques.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_cluster_layout.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_cogent3_tree.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_complex.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_dag.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_directed.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_four_grids.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_grouping.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_house.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_knuth_miles.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_labels_and_colors.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_max_bipartite_matching.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_minimum_spanning_trees.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_multipartite_layout.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_parallel_igraph_networkx.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_ports.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_shortest_path.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_simple_networkx.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_skbio_tree.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_style.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_traveling_salesman.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_voronoi.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/gallery/plot_with_colorbar.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/__init__.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/edge/arrow.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/edge/ports.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/groups.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/network.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/typing.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/utils/geometry.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/utils/internal.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/utils/matplotlib.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/iplotx/utils/style.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/pyproject.toml +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/scripts/update_pylint_badge.sh +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_biopython/tree_basic.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_cogent3/tree_basic.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_ete4/tree_basic.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/clustering_directed.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/clustering_directed_large.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/graph_basic.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/graph_directed.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/graph_directed_curved_loops.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/graph_edit_children.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/graph_labels.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/graph_layout_attribute.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/graph_null.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/graph_squares_directed.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/igraph_layout_object.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_igraph/multigraph_with_curved_edges_undirected.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_networkx/cluster-layout.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_networkx/complex.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_networkx/directed_graph.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_networkx/directed_graph_with_colorbar.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_networkx/empty_graph.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_networkx/flat_style.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_networkx/house_with_colors.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_networkx/labels_and_colors.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_networkx/shortest_path.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/baseline_images/test_skbio/tree_basic.png +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/test_style.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/tests/utils.py +0 -0
- {iplotx-0.2.1 → iplotx-0.3.0}/uv.lock +0 -0
|
@@ -19,18 +19,31 @@ jobs:
|
|
|
19
19
|
release-build:
|
|
20
20
|
runs-on: ubuntu-latest
|
|
21
21
|
|
|
22
|
+
strategy:
|
|
23
|
+
matrix:
|
|
24
|
+
python-version: ["3.11"]
|
|
25
|
+
|
|
22
26
|
steps:
|
|
23
27
|
- uses: actions/checkout@v4
|
|
24
28
|
|
|
25
|
-
-
|
|
29
|
+
- name: Install uv
|
|
30
|
+
uses: astral-sh/setup-uv@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: ${{ matrix.python-version }}
|
|
33
|
+
|
|
34
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
35
|
+
uses: actions/setup-python@v5
|
|
26
36
|
with:
|
|
27
|
-
python-version:
|
|
37
|
+
python-version: ${{ matrix.python-version }}
|
|
28
38
|
|
|
29
|
-
- name:
|
|
39
|
+
- name: Install the project
|
|
30
40
|
run: |
|
|
31
|
-
#
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
# Make sure you are in the right environment
|
|
42
|
+
uv sync
|
|
43
|
+
# Clean dist/
|
|
44
|
+
rm -f dist/*
|
|
45
|
+
# Build into dist/
|
|
46
|
+
uv build
|
|
34
47
|
|
|
35
48
|
- name: Upload distributions
|
|
36
49
|
uses: actions/upload-artifact@v4
|
|
@@ -51,7 +64,7 @@ jobs:
|
|
|
51
64
|
environment:
|
|
52
65
|
name: pypi
|
|
53
66
|
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
|
|
54
|
-
|
|
67
|
+
url: https://pypi.org/p/iplotx
|
|
55
68
|
#
|
|
56
69
|
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
|
|
57
70
|
# ALTERNATIVE: exactly, uncomment the following line instead:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: iplotx
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.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
|
|
@@ -79,6 +79,7 @@ See [gallery](https://iplotx.readthedocs.io/en/latest/gallery/index.html).
|
|
|
79
79
|
- Efficient plotting of large graphs using matplotlib's collection functionality. ✅
|
|
80
80
|
- Support editing plotting elements after the plot is created, e.g. changing node colors, labels, etc. ✅
|
|
81
81
|
- Support animations, e.g. showing the evolution of a network over time. ✅
|
|
82
|
+
- Support mouse interaction, e.g. hovering over or clicking on nodes and edges to get information about them. ✅
|
|
82
83
|
- Support trees from special libraries such as ete3, biopython, etc. This will need a dedicated function and layouting. ✅
|
|
83
84
|
- Support uni- and bi-directional communication between graph object and plot object.🏗️
|
|
84
85
|
|
|
@@ -41,6 +41,7 @@ See [gallery](https://iplotx.readthedocs.io/en/latest/gallery/index.html).
|
|
|
41
41
|
- Efficient plotting of large graphs using matplotlib's collection functionality. ✅
|
|
42
42
|
- Support editing plotting elements after the plot is created, e.g. changing node colors, labels, etc. ✅
|
|
43
43
|
- Support animations, e.g. showing the evolution of a network over time. ✅
|
|
44
|
+
- Support mouse interaction, e.g. hovering over or clicking on nodes and edges to get information about them. ✅
|
|
44
45
|
- Support trees from special libraries such as ete3, biopython, etc. This will need a dedicated function and layouting. ✅
|
|
45
46
|
- Support uni- and bi-directional communication between graph object and plot object.🏗️
|
|
46
47
|
|
|
@@ -74,13 +74,15 @@ See <project:gallery/index.rst> for examples of plots made with `iplotx`. Feel f
|
|
|
74
74
|
- compatibility with many GUI frameworks (e.g. Qt, GTK, Tkinter) thanks to `matplotlib`
|
|
75
75
|
- data-driven axes autoscaling
|
|
76
76
|
- consistent behaviour upon zooming and panning
|
|
77
|
-
- correct HiDPI scaling (e.g. retina screens)
|
|
77
|
+
- correct HiDPI scaling (e.g. retina screens) including for vertex sizes, arrow sizes, and edge offsets
|
|
78
78
|
- a consistent `matplotlib` artist hierarchy
|
|
79
79
|
- post-plot editability (e.g. for animations)
|
|
80
80
|
- plays well with other charting tools (e.g. `seaborn`)
|
|
81
81
|
- chainable style contexts
|
|
82
82
|
- vertex clusterings and covers with convex hulls and rounding
|
|
83
83
|
- a plugin mechanism for additional libraries (WIP)
|
|
84
|
+
- animations (see <project:gallery/plot_animation.rst>)
|
|
85
|
+
- mouse/keyboard interaction and events (e.g. hover, click, see <project:gallery/plot_mouse_hover.rst>)
|
|
84
86
|
- ... and probably more by the time you read this.
|
|
85
87
|
|
|
86
88
|
## Styles
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Computation times
|
|
8
8
|
=================
|
|
9
|
-
**00:01.
|
|
9
|
+
**00:01.212** total execution time for 36 files **from all galleries**:
|
|
10
10
|
|
|
11
11
|
.. container::
|
|
12
12
|
|
|
@@ -32,8 +32,11 @@ Computation times
|
|
|
32
32
|
* - Example
|
|
33
33
|
- Time
|
|
34
34
|
- Mem (MB)
|
|
35
|
+
* - :ref:`sphx_glr_gallery_plot_ete4.py` (``../../gallery/plot_ete4.py``)
|
|
36
|
+
- 00:01.212
|
|
37
|
+
- 0.0
|
|
35
38
|
* - :ref:`sphx_glr_gallery_plot_animation.py` (``../../gallery/plot_animation.py``)
|
|
36
|
-
- 00:
|
|
39
|
+
- 00:00.000
|
|
37
40
|
- 0.0
|
|
38
41
|
* - :ref:`sphx_glr_gallery_plot_basic.py` (``../../gallery/plot_basic.py``)
|
|
39
42
|
- 00:00.000
|
|
@@ -56,6 +59,9 @@ Computation times
|
|
|
56
59
|
* - :ref:`sphx_glr_gallery_plot_cogent3_tree.py` (``../../gallery/plot_cogent3_tree.py``)
|
|
57
60
|
- 00:00.000
|
|
58
61
|
- 0.0
|
|
62
|
+
* - :ref:`sphx_glr_gallery_plot_company_structure.py` (``../../gallery/plot_company_structure.py``)
|
|
63
|
+
- 00:00.000
|
|
64
|
+
- 0.0
|
|
59
65
|
* - :ref:`sphx_glr_gallery_plot_complex.py` (``../../gallery/plot_complex.py``)
|
|
60
66
|
- 00:00.000
|
|
61
67
|
- 0.0
|
|
@@ -68,9 +74,6 @@ Computation times
|
|
|
68
74
|
* - :ref:`sphx_glr_gallery_plot_edit_artists.py` (``../../gallery/plot_edit_artists.py``)
|
|
69
75
|
- 00:00.000
|
|
70
76
|
- 0.0
|
|
71
|
-
* - :ref:`sphx_glr_gallery_plot_ete4.py` (``../../gallery/plot_ete4.py``)
|
|
72
|
-
- 00:00.000
|
|
73
|
-
- 0.0
|
|
74
77
|
* - :ref:`sphx_glr_gallery_plot_four_grids.py` (``../../gallery/plot_four_grids.py``)
|
|
75
78
|
- 00:00.000
|
|
76
79
|
- 0.0
|
|
@@ -95,6 +98,9 @@ Computation times
|
|
|
95
98
|
* - :ref:`sphx_glr_gallery_plot_minimum_spanning_trees.py` (``../../gallery/plot_minimum_spanning_trees.py``)
|
|
96
99
|
- 00:00.000
|
|
97
100
|
- 0.0
|
|
101
|
+
* - :ref:`sphx_glr_gallery_plot_mouse_hover.py` (``../../gallery/plot_mouse_hover.py``)
|
|
102
|
+
- 00:00.000
|
|
103
|
+
- 0.0
|
|
98
104
|
* - :ref:`sphx_glr_gallery_plot_multipartite_layout.py` (``../../gallery/plot_multipartite_layout.py``)
|
|
99
105
|
- 00:00.000
|
|
100
106
|
- 0.0
|
|
@@ -122,6 +128,12 @@ Computation times
|
|
|
122
128
|
* - :ref:`sphx_glr_gallery_plot_traveling_salesman.py` (``../../gallery/plot_traveling_salesman.py``)
|
|
123
129
|
- 00:00.000
|
|
124
130
|
- 0.0
|
|
131
|
+
* - :ref:`sphx_glr_gallery_plot_tree_node_background.py` (``../../gallery/plot_tree_node_background.py``)
|
|
132
|
+
- 00:00.000
|
|
133
|
+
- 0.0
|
|
134
|
+
* - :ref:`sphx_glr_gallery_plot_trees_of_trees.py` (``../../gallery/plot_trees_of_trees.py``)
|
|
135
|
+
- 00:00.000
|
|
136
|
+
- 0.0
|
|
125
137
|
* - :ref:`sphx_glr_gallery_plot_voronoi.py` (``../../gallery/plot_voronoi.py``)
|
|
126
138
|
- 00:00.000
|
|
127
139
|
- 0.0
|
|
@@ -28,6 +28,7 @@ ipx.plotting.tree(
|
|
|
28
28
|
# Moreover, the plot can be customised further using hmargin (horizontal label margin)
|
|
29
29
|
# and some `matplotlib` settings.
|
|
30
30
|
|
|
31
|
+
# sphinx_gallery_thumbnail_number = 2
|
|
31
32
|
leaf_labels = {leaf: f"Species {i+1}" for i, leaf in enumerate(tree.get_terminals())}
|
|
32
33
|
fig, ax = plt.subplots(figsize=(4, 4))
|
|
33
34
|
ipx.plotting.tree(
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Company structure
|
|
3
|
+
=================
|
|
4
|
+
|
|
5
|
+
This example shows how to use `iplotx` to visualise simple logical relationships, for instance the organisational chart of a company.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import networkx as nx
|
|
9
|
+
import matplotlib.pyplot as plt
|
|
10
|
+
import iplotx as ipx
|
|
11
|
+
|
|
12
|
+
g = nx.DiGraph()
|
|
13
|
+
g.add_edges_from(
|
|
14
|
+
[
|
|
15
|
+
("CEO", "Manager 1"),
|
|
16
|
+
("CEO", "Manager 2"),
|
|
17
|
+
("CEO", "Manager 3"),
|
|
18
|
+
("Manager 1", "Employee 1"),
|
|
19
|
+
("Manager 1", "Employee 2"),
|
|
20
|
+
("Manager 2", "Employee 3"),
|
|
21
|
+
("Manager 2", "Employee 4"),
|
|
22
|
+
("Manager 3", "Employee 4"),
|
|
23
|
+
]
|
|
24
|
+
)
|
|
25
|
+
layout = {
|
|
26
|
+
"CEO": [0, 0],
|
|
27
|
+
"Manager 1": [1, -1],
|
|
28
|
+
"Manager 2": [1, 0],
|
|
29
|
+
"Manager 3": [1, 1],
|
|
30
|
+
"Employee 1": [2, -1],
|
|
31
|
+
"Employee 2": [2, -0.5],
|
|
32
|
+
"Employee 3": [2, 0],
|
|
33
|
+
"Employee 4": [2, 0.5],
|
|
34
|
+
}
|
|
35
|
+
fig, ax = plt.subplots()
|
|
36
|
+
ipx.network(
|
|
37
|
+
g,
|
|
38
|
+
layout=layout,
|
|
39
|
+
ax=ax,
|
|
40
|
+
vertex_labels=True,
|
|
41
|
+
style="hollow",
|
|
42
|
+
vertex_marker="r",
|
|
43
|
+
edge_ports=[("e", "w")] * 8,
|
|
44
|
+
edge_curved=True,
|
|
45
|
+
edge_tension=[0.65] * 3 + [0.6] * 5,
|
|
46
|
+
margins=(0.08, 0.05),
|
|
47
|
+
)
|
|
48
|
+
# Show the layout top to bottom for clarity
|
|
49
|
+
ax.invert_yaxis()
|
|
50
|
+
|
|
51
|
+
# %%
|
|
52
|
+
# If you prefer a more squared look, you can use S-style waypoints with per-edge offsets:
|
|
53
|
+
|
|
54
|
+
fig, ax = plt.subplots()
|
|
55
|
+
ipx.network(
|
|
56
|
+
g,
|
|
57
|
+
layout=layout,
|
|
58
|
+
ax=ax,
|
|
59
|
+
vertex_labels=True,
|
|
60
|
+
style="hollow",
|
|
61
|
+
vertex_marker="r",
|
|
62
|
+
edge_ports=[("e", "w")] * 8,
|
|
63
|
+
edge_waypoints="xmidy0,xmidy1",
|
|
64
|
+
edge_offset=[(0, 0)] * 7 + [(0, -6)],
|
|
65
|
+
margins=(0.08, 0.05),
|
|
66
|
+
edge_linestyle=["-"] * 7 + ["--"],
|
|
67
|
+
)
|
|
68
|
+
ax.invert_yaxis()
|
|
69
|
+
|
|
70
|
+
# %%
|
|
71
|
+
# The `offset` edge style bypasses any layout coordinate system and acts in figure points directly.
|
|
72
|
+
# Combining edge offsets with noncartesian layout coordinate systems (e.g. `polar`) can lead to unexpected results.
|
|
@@ -21,19 +21,32 @@ ipx.plotting.tree(
|
|
|
21
21
|
|
|
22
22
|
# %%
|
|
23
23
|
# `iplotx` can compute a radial tree layout as well, and usual style modifications
|
|
24
|
-
# work for trees same as networks
|
|
24
|
+
# work for trees same as networks. Moreover, trees have a layout style option to
|
|
25
|
+
# choose the starting angle and angular span of the radial layout.
|
|
25
26
|
|
|
27
|
+
# sphinx_gallery_thumbnail_number = 2
|
|
26
28
|
ipx.plotting.tree(
|
|
27
29
|
tree,
|
|
28
30
|
layout="radial",
|
|
31
|
+
orientation="right",
|
|
29
32
|
style=[
|
|
30
33
|
"tree",
|
|
31
34
|
{
|
|
32
35
|
"edge": {
|
|
33
|
-
"color": "
|
|
36
|
+
"color": "deeppink",
|
|
34
37
|
"linewidth": 4,
|
|
35
38
|
},
|
|
39
|
+
"layout": {
|
|
40
|
+
"start": -180,
|
|
41
|
+
"span": 180,
|
|
42
|
+
},
|
|
43
|
+
"vertex": {
|
|
44
|
+
"label": {
|
|
45
|
+
"hmargin": 15,
|
|
46
|
+
}
|
|
47
|
+
},
|
|
36
48
|
},
|
|
37
49
|
],
|
|
50
|
+
vertex_labels={leaf: str(i + 1) for i, leaf in enumerate(tree.leaves())},
|
|
38
51
|
aspect=1,
|
|
39
52
|
)
|
|
@@ -37,7 +37,7 @@ ipx.plot(
|
|
|
37
37
|
},
|
|
38
38
|
"edge": {
|
|
39
39
|
"linestyle": linestyle,
|
|
40
|
-
"
|
|
40
|
+
"paralleloffset": 0,
|
|
41
41
|
"looptension": 3.5,
|
|
42
42
|
"arrow": {
|
|
43
43
|
"marker": "|>",
|
|
@@ -61,7 +61,7 @@ ipx.plot(
|
|
|
61
61
|
vertex_edgecolor="none",
|
|
62
62
|
vertex_label_color="black",
|
|
63
63
|
edge_linestyle=linestyle,
|
|
64
|
-
|
|
64
|
+
edge_paralleloffset=0,
|
|
65
65
|
edge_looptension=3.5,
|
|
66
66
|
edge_arrow_marker="|>",
|
|
67
67
|
),
|
|
@@ -80,7 +80,7 @@ ipx.plot(
|
|
|
80
80
|
vertex_edgecolor="none",
|
|
81
81
|
vertex_label_color="black",
|
|
82
82
|
edge_linestyle=linestyle,
|
|
83
|
-
|
|
83
|
+
edge_paralleloffset=0,
|
|
84
84
|
edge_looptension=3.5,
|
|
85
85
|
edge_arrow_marker="|>",
|
|
86
86
|
)
|
|
@@ -94,7 +94,7 @@ with ipx.style.context(
|
|
|
94
94
|
vertex_edgecolor="none",
|
|
95
95
|
vertex_label_color="black",
|
|
96
96
|
edge_linestyle=linestyle,
|
|
97
|
-
|
|
97
|
+
edge_paralleloffset=0,
|
|
98
98
|
edge_looptension=3.5,
|
|
99
99
|
edge_arrow_marker="|>",
|
|
100
100
|
):
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Mouse event handling
|
|
3
|
+
====================
|
|
4
|
+
|
|
5
|
+
This example shows how to interact with mouse events (e.g. hovering) in `iplotx`.
|
|
6
|
+
|
|
7
|
+
.. warning::
|
|
8
|
+
This example will run in a Python, IPython, or Jupyter session, however the
|
|
9
|
+
interactive functionality is not visible on the HTML page. Download the code
|
|
10
|
+
at the end of this page and run it in a local Python environment to see
|
|
11
|
+
the results.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import matplotlib.pyplot as plt
|
|
15
|
+
import numpy as np
|
|
16
|
+
import igraph as ig
|
|
17
|
+
import iplotx as ipx
|
|
18
|
+
|
|
19
|
+
g = ig.Graph.Ring(3, directed=True)
|
|
20
|
+
|
|
21
|
+
fig, ax = plt.subplots()
|
|
22
|
+
art = ipx.network(
|
|
23
|
+
g,
|
|
24
|
+
layout="circle",
|
|
25
|
+
ax=ax,
|
|
26
|
+
aspect=1,
|
|
27
|
+
)[0]
|
|
28
|
+
vertex_artist = art.get_vertices()
|
|
29
|
+
|
|
30
|
+
# Prepare an invisible annotation for hovering
|
|
31
|
+
annot = ax.annotate(
|
|
32
|
+
"",
|
|
33
|
+
xy=(0, 0),
|
|
34
|
+
xytext=(20, 20),
|
|
35
|
+
textcoords="offset points",
|
|
36
|
+
bbox=dict(boxstyle="round", fc=(0, 0, 0, 0.2)),
|
|
37
|
+
arrowprops=dict(arrowstyle="->"),
|
|
38
|
+
)
|
|
39
|
+
annot.set_visible(False)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def hover_callback(event):
|
|
43
|
+
"""React to mouse hovering over vertices."""
|
|
44
|
+
if event.inaxes == ax:
|
|
45
|
+
vc = art.get_vertices()
|
|
46
|
+
cont, ind = vc.contains(event)
|
|
47
|
+
# If mouse is over a vertex, show the buble
|
|
48
|
+
if cont:
|
|
49
|
+
i = ind["ind"][0]
|
|
50
|
+
annot.xy = vc.get_offsets()[i]
|
|
51
|
+
annot.set_text(f"{i+1}")
|
|
52
|
+
annot.set_visible(True)
|
|
53
|
+
# Otherwise, hide the bubble
|
|
54
|
+
elif annot.get_visible():
|
|
55
|
+
annot.set_visible(False)
|
|
56
|
+
# If nothing changed, no need to redraw
|
|
57
|
+
else:
|
|
58
|
+
return
|
|
59
|
+
|
|
60
|
+
# Redraw to show/hide the bubble
|
|
61
|
+
fig.canvas.draw_idle()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
fig.canvas.mpl_connect(
|
|
65
|
+
"motion_notify_event",
|
|
66
|
+
hover_callback,
|
|
67
|
+
)
|
|
@@ -10,12 +10,12 @@ import iplotx as ipx
|
|
|
10
10
|
|
|
11
11
|
G = nx.path_graph(8)
|
|
12
12
|
pos = nx.spring_layout(G, seed=47) # Seed layout for reproducibility
|
|
13
|
-
ipx.
|
|
13
|
+
ipx.network(G, layout=pos)
|
|
14
14
|
|
|
15
15
|
# %%
|
|
16
16
|
# We can change the color of the vertices and edges with a touch of style:
|
|
17
17
|
|
|
18
|
-
ipx.
|
|
18
|
+
ipx.network(
|
|
19
19
|
G,
|
|
20
20
|
layout=pos,
|
|
21
21
|
style={
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tree cascades
|
|
3
|
+
=============
|
|
4
|
+
|
|
5
|
+
This example shows how to use `iplotx` to add cascading backgrounds to trees.
|
|
6
|
+
"Cascading" here means that each patch (rectangle/wedge/etc.) will cover a node
|
|
7
|
+
and all descendants, down to the leaves.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from Bio import Phylo
|
|
11
|
+
from io import StringIO
|
|
12
|
+
import matplotlib.pyplot as plt
|
|
13
|
+
import iplotx as ipx
|
|
14
|
+
|
|
15
|
+
# Make a tree from a string in Newick format
|
|
16
|
+
tree = next(
|
|
17
|
+
Phylo.NewickIO.parse(
|
|
18
|
+
StringIO(
|
|
19
|
+
"(()(()((()())(()()))))",
|
|
20
|
+
)
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
backgrounds = {
|
|
25
|
+
tree.get_nonterminals()[3]: "turquoise",
|
|
26
|
+
tree.get_terminals()[0]: "tomato",
|
|
27
|
+
tree.get_terminals()[1]: "purple",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ipx.plotting.tree(
|
|
31
|
+
tree,
|
|
32
|
+
vertex_cascade_facecolor=backgrounds,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# %%
|
|
36
|
+
# Cascading patches have a style option "extend" which affects whether the patches extend to the end of the deepest leaf:
|
|
37
|
+
|
|
38
|
+
ipx.plotting.tree(
|
|
39
|
+
tree,
|
|
40
|
+
layout="vertical",
|
|
41
|
+
vertex_cascade_facecolor=backgrounds,
|
|
42
|
+
vertex_cascade_extend=True,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# %%
|
|
46
|
+
# Cascading patches work with radial layouts as well:
|
|
47
|
+
|
|
48
|
+
# sphinx_gallery_thumbnail_number = 3
|
|
49
|
+
ipx.plotting.tree(
|
|
50
|
+
tree,
|
|
51
|
+
layout="radial",
|
|
52
|
+
vertex_cascade_facecolor=backgrounds,
|
|
53
|
+
vertex_cascade_extend=True,
|
|
54
|
+
aspect=1,
|
|
55
|
+
)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tree of trees
|
|
3
|
+
=============
|
|
4
|
+
|
|
5
|
+
This example shows how to plot trees at the leaf of a tree, using the `iplotx` library.
|
|
6
|
+
Note that there are a few conceivable ways to do similar things as this in
|
|
7
|
+
`matplotlib` and this is just one such approach, using inset axes.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from ete4 import Tree
|
|
11
|
+
import matplotlib.pyplot as plt
|
|
12
|
+
import iplotx as ipx
|
|
13
|
+
|
|
14
|
+
tree = Tree(
|
|
15
|
+
"(,((),(((),()),((),()))));",
|
|
16
|
+
)
|
|
17
|
+
subtree_strings = [
|
|
18
|
+
"((a,b),(c,d));",
|
|
19
|
+
"(a,((b,c),d));",
|
|
20
|
+
"(a,b,c,d);",
|
|
21
|
+
"(a,(b,(c,d)));",
|
|
22
|
+
"(a,b);",
|
|
23
|
+
"(a,(b,c,d));",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
# Plot the initial tree
|
|
27
|
+
fig, ax = plt.subplots(figsize=(8, 5))
|
|
28
|
+
art = ipx.tree(
|
|
29
|
+
tree,
|
|
30
|
+
ax=ax,
|
|
31
|
+
aspect=1,
|
|
32
|
+
edge_color="grey",
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
for i, leaf in enumerate(tree.leaves()):
|
|
36
|
+
|
|
37
|
+
# Create an axis in the rough proximity
|
|
38
|
+
# and with the rough diemension of a leaf,
|
|
39
|
+
# with some padding
|
|
40
|
+
x, y = art.get_layout().T[leaf].values
|
|
41
|
+
subax = ax.inset_axes(
|
|
42
|
+
(x + 0.1, y - 0.4, 1.2, 0.8),
|
|
43
|
+
transform=ax.transData,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# For each leaf, make a tree
|
|
47
|
+
subtree = Tree(subtree_strings[i])
|
|
48
|
+
# Plot the tree with dashed lines
|
|
49
|
+
ipx.tree(
|
|
50
|
+
subtree,
|
|
51
|
+
ax=subax,
|
|
52
|
+
edge_linestyle="--",
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# %%
|
|
56
|
+
# Combining this with other elements, e.g. cascading backgrounds, is possible too:
|
|
57
|
+
|
|
58
|
+
fig, ax = plt.subplots(figsize=(8, 5))
|
|
59
|
+
art = ipx.tree(
|
|
60
|
+
tree,
|
|
61
|
+
ax=ax,
|
|
62
|
+
aspect=1,
|
|
63
|
+
edge_color="grey",
|
|
64
|
+
vertex_cascade_facecolor={
|
|
65
|
+
list(tree.leaves())[0]: "lightblue",
|
|
66
|
+
list(tree.traverse("preorder"))[2]: "pink",
|
|
67
|
+
},
|
|
68
|
+
)
|
|
69
|
+
for i, leaf in enumerate(tree.leaves()):
|
|
70
|
+
x, y = art.get_layout().T[leaf].values
|
|
71
|
+
subax = ax.inset_axes(
|
|
72
|
+
(x + 0.1, y - 0.4, 1.2, 0.8),
|
|
73
|
+
transform=ax.transData,
|
|
74
|
+
)
|
|
75
|
+
# Set the inset axes background transparent
|
|
76
|
+
subax.patch.set_alpha(0)
|
|
77
|
+
|
|
78
|
+
subtree = Tree(subtree_strings[i])
|
|
79
|
+
ipx.tree(
|
|
80
|
+
subtree,
|
|
81
|
+
ax=subax,
|
|
82
|
+
edge_linestyle="--",
|
|
83
|
+
)
|