iplotx 0.4.0__tar.gz → 0.5.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.4.0 → iplotx-0.5.0}/.github/workflows/test.yml +5 -2
- iplotx-0.5.0/.pre-commit-config.yaml +54 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/MANIFEST.in +0 -1
- {iplotx-0.4.0 → iplotx-0.5.0}/PKG-INFO +2 -1
- {iplotx-0.4.0 → iplotx-0.5.0}/README.md +1 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/api/artists.md +0 -1
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/api/complete_style_specification.md +2 -2
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/api/providers.md +0 -1
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/conf.py +1 -2
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/sg_execution_times.rst +16 -4
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_animation.py +5 -2
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_chess_masters.py +10 -5
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_dag.py +0 -1
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_edit_artists.py +4 -4
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_grouping.py +14 -9
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_house.py +1 -3
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_knuth_miles.py +0 -1
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_loops.py +7 -8
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_max_bipartite_matching.py +4 -4
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_minimum_spanning_trees.py +5 -5
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_mouse_hover.py +1 -2
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_ports.py +15 -9
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_shortest_path.py +1 -3
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_simple_networkx.py +3 -2
- iplotx-0.4.0/gallery/plot_simpledataprovider.py → iplotx-0.5.0/gallery/plot_simplenetworkdataprovider.py +3 -3
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_style.py +8 -6
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_traveling_salesman.py +1 -2
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_vertexmarkers.py +1 -3
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_voronoi.py +5 -1
- iplotx-0.5.0/gallery/tree/plot_angular_waypoints.py +87 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/plot_biopython_tree.py +1 -1
- iplotx-0.5.0/gallery/tree/plot_cladeedges.py +38 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/plot_cogent3_tree.py +1 -1
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/plot_leafedges_and_cascades.py +1 -2
- iplotx-0.5.0/gallery/tree/plot_simpletreedataprovider.py +48 -0
- iplotx-0.5.0/gallery/tree/plot_split_edges.py +46 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/plot_tree_node_background.py +1 -3
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/plot_tree_style_clades.py +23 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/plot_trees_of_trees.py +0 -1
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/cascades.py +19 -28
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/edge/__init__.py +74 -6
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/edge/arrow.py +10 -3
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/edge/geometry.py +7 -17
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/edge/ports.py +3 -2
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/groups.py +1 -3
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/ingest/__init__.py +5 -14
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/ingest/heuristics.py +1 -4
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/ingest/providers/network/igraph.py +4 -12
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/ingest/providers/network/networkx.py +6 -20
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/ingest/providers/network/simple.py +2 -9
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/ingest/providers/tree/biopython.py +2 -5
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/ingest/providers/tree/cogent3.py +2 -5
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/ingest/providers/tree/ete4.py +2 -5
- iplotx-0.5.0/iplotx/ingest/providers/tree/simple.py +97 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/ingest/providers/tree/skbio.py +2 -5
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/ingest/typing.py +5 -14
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/network.py +4 -7
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/plotting.py +1 -1
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/style/__init__.py +131 -106
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/style/leaf_info.py +3 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/style/library.py +94 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/tree.py +55 -42
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/typing.py +2 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/utils/geometry.py +32 -40
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/utils/matplotlib.py +13 -10
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/utils/style.py +6 -1
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/version.py +1 -1
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/vertex.py +16 -23
- {iplotx-0.4.0 → iplotx-0.5.0}/pyproject.toml +5 -0
- iplotx-0.5.0/tests/baseline_images/test_biopython/cascades.png +0 -0
- iplotx-0.5.0/tests/baseline_images/test_biopython/leafedges.png +0 -0
- iplotx-0.5.0/tests/baseline_images/test_biopython/show_support.png +0 -0
- iplotx-0.5.0/tests/baseline_images/test_ete4/split_edges.png +0 -0
- iplotx-0.5.0/tests/baseline_images/test_igraph/graph_with_curved_edges.png +0 -0
- iplotx-0.5.0/tests/baseline_images/test_igraph/igraph_layout_object.png +0 -0
- iplotx-0.5.0/tests/baseline_images/test_networkx/complex_rotatelabels.png +0 -0
- iplotx-0.5.0/tests/baseline_images/test_simple_network_provider/graph_basic.png +0 -0
- iplotx-0.5.0/tests/baseline_images/test_simple_network_provider/graph_directed.png +0 -0
- iplotx-0.5.0/tests/baseline_images/test_simple_network_provider/graph_labels.png +0 -0
- iplotx-0.5.0/tests/test_arrows.py +109 -0
- iplotx-0.5.0/tests/test_biopython.py +236 -0
- iplotx-0.5.0/tests/test_cascades.py +127 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/test_cogent3.py +4 -12
- iplotx-0.5.0/tests/test_edge.py +77 -0
- iplotx-0.5.0/tests/test_edge_geometry.py +136 -0
- iplotx-0.5.0/tests/test_ete4.py +84 -0
- iplotx-0.5.0/tests/test_geometry.py +146 -0
- iplotx-0.5.0/tests/test_heuristics.py +117 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/test_igraph.py +6 -16
- iplotx-0.5.0/tests/test_matplotlib_utils.py +18 -0
- iplotx-0.5.0/tests/test_network_hotload.py +41 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/test_networkx.py +51 -16
- iplotx-0.5.0/tests/test_ports.py +34 -0
- iplotx-0.5.0/tests/test_simple_network_provider.py +136 -0
- iplotx-0.5.0/tests/test_simple_tree_provider.py +92 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/test_skbio.py +4 -10
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/test_style.py +16 -8
- iplotx-0.5.0/tests/test_vertex.py +216 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/utils.py +5 -7
- {iplotx-0.4.0 → iplotx-0.5.0}/uv.lock +116 -0
- iplotx-0.4.0/tests/baseline_images/test_igraph/igraph_layout_object.png +0 -0
- iplotx-0.4.0/tests/test_biopython.py +0 -85
- iplotx-0.4.0/tests/test_ete4.py +0 -81
- {iplotx-0.4.0 → iplotx-0.5.0}/.github/workflows/publish.yml +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/.gitignore +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/.readthedocs.yaml +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/LICENSE +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/assets/pylint.svg +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/Makefile +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/make.bat +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/_static/graph_basic.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/_templates/layout.html +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/api/plotting.md +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/api/style.md +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/api.md +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/images/sphx_glr_plot_basic_001.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/images/thumb/sphx_glr_plot_basic_thumb.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/index.md +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/providers.md +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/docs/source/style.md +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/GALLERY_HEADER.rst +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/data/chess_masters_WCC.pgn.bz2 +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/data/knuth_miles.txt.gz +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_arrows.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_basic.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_big_curves.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_cliques.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_cluster_layout.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_company_structure.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_complex.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_directed.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_four_grids.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_halfarrows.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_labels_and_colors.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_multipartite_layout.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_multistyle.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_parallel_igraph_networkx.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_simple_path.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_tension.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/plot_with_colorbar.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/GALLERY_HEADER.rst +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/data/tree-with-support.json +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/plot_cogent3_layouts.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/plot_ete4.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/plot_leafedges.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/plot_skbio_tree.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/gallery/tree/plot_support.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/__init__.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/artists.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/edge/leaf.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/label.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/layout.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/iplotx/utils/internal.py +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/scripts/copy_github_release_into_version.sh +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/scripts/update_pylint_badge.sh +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_biopython/leaf_labels.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_biopython/leaf_labels_hmargin.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_biopython/tree_basic.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_biopython/tree_radial.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_cogent3/leaf_labels.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_cogent3/leaf_labels_hmargin.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_cogent3/tree_basic.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_cogent3/tree_radial.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_ete4/leaf_labels.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_ete4/leaf_labels_hmargin.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_ete4/tree_basic.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_ete4/tree_radial.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_igraph/clustering_directed.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_igraph/clustering_directed_large.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_basic.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_directed.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_directed_curved_loops.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_edit_children.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_labels.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_layout_attribute.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_null.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_squares_directed.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_igraph/multigraph_with_curved_edges_undirected.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_networkx/cluster-layout.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_networkx/complex.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_networkx/directed_graph.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_networkx/directed_graph_with_colorbar.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_networkx/empty_graph.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_networkx/flat_style.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_networkx/house_with_colors.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_networkx/labels_and_colors.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_networkx/shortest_path.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_networkx/simple_graph.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_skbio/leaf_labels.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_skbio/leaf_labels_hmargin.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_skbio/tree_basic.png +0 -0
- {iplotx-0.4.0 → iplotx-0.5.0}/tests/baseline_images/test_skbio/tree_radial.png +0 -0
|
@@ -35,7 +35,10 @@ jobs:
|
|
|
35
35
|
run: uv sync --all-extras --group test
|
|
36
36
|
|
|
37
37
|
- name: Run pytest
|
|
38
|
-
run: uv run pytest tests
|
|
38
|
+
run: uv run pytest --cov-report term-missing --cov=iplotx tests
|
|
39
|
+
|
|
40
|
+
- name: Coveralls
|
|
41
|
+
uses: coverallsapp/github-action@v2
|
|
39
42
|
|
|
40
43
|
- name: Run flake8
|
|
41
|
-
run: uv run flake8 iplotx --count --exit-zero --max-complexity=
|
|
44
|
+
run: uv run flake8 iplotx --count --exit-zero --max-complexity=20 --max-line-length=127 --statistics
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# See https://pre-commit.com for more information
|
|
2
|
+
# See https://pre-commit.com/hooks.html for more hooks
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
+
rev: v5.0.0
|
|
6
|
+
hooks:
|
|
7
|
+
- id: trailing-whitespace
|
|
8
|
+
- id: end-of-file-fixer
|
|
9
|
+
- id: check-yaml
|
|
10
|
+
- id: check-added-large-files
|
|
11
|
+
|
|
12
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
13
|
+
# Ruff version.
|
|
14
|
+
rev: v0.12.3
|
|
15
|
+
hooks:
|
|
16
|
+
# Run the linter.
|
|
17
|
+
- id: ruff-check
|
|
18
|
+
types_or: [ python, pyi ]
|
|
19
|
+
args: [ --fix ]
|
|
20
|
+
# Run the formatter.
|
|
21
|
+
- id: ruff-format
|
|
22
|
+
types_or: [ python, pyi ]
|
|
23
|
+
|
|
24
|
+
#- repo: https://github.com/psf/black
|
|
25
|
+
# rev: 25.1.0
|
|
26
|
+
# hooks:
|
|
27
|
+
# - id: black
|
|
28
|
+
# args: [--check,--target-version,py311]
|
|
29
|
+
- repo: https://github.com/PyCQA/flake8
|
|
30
|
+
rev: 7.3.0
|
|
31
|
+
hooks:
|
|
32
|
+
- id: flake8
|
|
33
|
+
args: [
|
|
34
|
+
--count,
|
|
35
|
+
--max-complexity=20,
|
|
36
|
+
--max-line-length=127,
|
|
37
|
+
--statistics,
|
|
38
|
+
--extend-ignore=RST399,
|
|
39
|
+
--exit-zero,
|
|
40
|
+
]
|
|
41
|
+
additional_dependencies: [
|
|
42
|
+
'flake8-rst-docstrings>=0.2.3',
|
|
43
|
+
]
|
|
44
|
+
#- repo: https://github.com/pre-commit/mirrors-mypy
|
|
45
|
+
# rev: v1.16.1
|
|
46
|
+
# hooks:
|
|
47
|
+
# - id: mypy
|
|
48
|
+
# files: '^(iplotx)/'
|
|
49
|
+
|
|
50
|
+
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
51
|
+
# uv version.
|
|
52
|
+
rev: 0.7.20
|
|
53
|
+
hooks:
|
|
54
|
+
- id: uv-lock
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: iplotx
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.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
|
|
@@ -39,6 +39,7 @@ Description-Content-Type: text/markdown
|
|
|
39
39
|

|
|
40
40
|

|
|
41
41
|

|
|
42
|
+
[](https://coveralls.io/github/fabilab/iplotx?branch=main)
|
|
42
43
|

|
|
43
44
|
|
|
44
45
|
# iplotx
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|

|
|
2
2
|

|
|
3
3
|

|
|
4
|
+
[](https://coveralls.io/github/fabilab/iplotx?branch=main)
|
|
4
5
|

|
|
5
6
|
|
|
6
7
|
# iplotx
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
# Marker style. Currently supported markers:
|
|
18
18
|
# o, c, circle: circle
|
|
19
|
-
|
|
19
|
+
# s, square, r, rectangle: rectangle (square if only one size specified)
|
|
20
20
|
# ^, triangle: upward triangle
|
|
21
21
|
# v, triangle_down: downward triangle
|
|
22
22
|
# <, triangle_left: leftward triangle
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
# 8, octagon: octagon
|
|
29
29
|
# *, star: 5-point star, upright
|
|
30
30
|
"marker": str,
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
"facecolor": str | Any, # Color of the vertex face (e.g. 'red', '#FF0000')
|
|
33
33
|
"edgecolor": str | Any, # Color of the vertex edge (e.g. 'black', '#000000')
|
|
34
34
|
"alpha": float, # Opacity of the vertex (0.0 for fully transparent, 1.0 for fully opaque)
|
|
@@ -49,7 +49,6 @@ myst_enable_extensions = ["colon_fence"]
|
|
|
49
49
|
sphinx_gallery_conf = {
|
|
50
50
|
"examples_dirs": "../../gallery", # path to your example scripts
|
|
51
51
|
"gallery_dirs": "./gallery", # path to where to save gallery generated output
|
|
52
|
-
#'matplotlib_animations': (True, 'mp4'),
|
|
53
52
|
"matplotlib_animations": True,
|
|
54
53
|
}
|
|
55
54
|
|
|
@@ -135,7 +134,7 @@ if link_github:
|
|
|
135
134
|
|
|
136
135
|
version = parse_version(iplotx.__version__)
|
|
137
136
|
tag = "main" if version.is_devrelease else f"v{version.public}"
|
|
138
|
-
return "https://github.com/fabilab/iplotx/blob
|
|
137
|
+
return f"https://github.com/fabilab/iplotx/blob/{tag}/{fn}{linespec}"
|
|
139
138
|
|
|
140
139
|
else:
|
|
141
140
|
extensions.append("sphinx.ext.viewcode")
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Computation times
|
|
8
8
|
=================
|
|
9
|
-
**00:01.
|
|
9
|
+
**00:01.263** total execution time for 51 files **from all galleries**:
|
|
10
10
|
|
|
11
11
|
.. container::
|
|
12
12
|
|
|
@@ -32,8 +32,8 @@ Computation times
|
|
|
32
32
|
* - Example
|
|
33
33
|
- Time
|
|
34
34
|
- Mem (MB)
|
|
35
|
-
* - :ref:`
|
|
36
|
-
- 00:01.
|
|
35
|
+
* - :ref:`sphx_glr_gallery_tree_plot_split_edges.py` (``../../gallery/tree/plot_split_edges.py``)
|
|
36
|
+
- 00:01.263
|
|
37
37
|
- 0.0
|
|
38
38
|
* - :ref:`sphx_glr_gallery_plot_animation.py` (``../../gallery/plot_animation.py``)
|
|
39
39
|
- 00:00.000
|
|
@@ -122,7 +122,7 @@ Computation times
|
|
|
122
122
|
* - :ref:`sphx_glr_gallery_plot_simple_path.py` (``../../gallery/plot_simple_path.py``)
|
|
123
123
|
- 00:00.000
|
|
124
124
|
- 0.0
|
|
125
|
-
* - :ref:`
|
|
125
|
+
* - :ref:`sphx_glr_gallery_plot_simplenetworkdataprovider.py` (``../../gallery/plot_simplenetworkdataprovider.py``)
|
|
126
126
|
- 00:00.000
|
|
127
127
|
- 0.0
|
|
128
128
|
* - :ref:`sphx_glr_gallery_plot_style.py` (``../../gallery/plot_style.py``)
|
|
@@ -143,9 +143,15 @@ Computation times
|
|
|
143
143
|
* - :ref:`sphx_glr_gallery_plot_with_colorbar.py` (``../../gallery/plot_with_colorbar.py``)
|
|
144
144
|
- 00:00.000
|
|
145
145
|
- 0.0
|
|
146
|
+
* - :ref:`sphx_glr_gallery_tree_plot_angular_waypoints.py` (``../../gallery/tree/plot_angular_waypoints.py``)
|
|
147
|
+
- 00:00.000
|
|
148
|
+
- 0.0
|
|
146
149
|
* - :ref:`sphx_glr_gallery_tree_plot_biopython_tree.py` (``../../gallery/tree/plot_biopython_tree.py``)
|
|
147
150
|
- 00:00.000
|
|
148
151
|
- 0.0
|
|
152
|
+
* - :ref:`sphx_glr_gallery_tree_plot_cladeedges.py` (``../../gallery/tree/plot_cladeedges.py``)
|
|
153
|
+
- 00:00.000
|
|
154
|
+
- 0.0
|
|
149
155
|
* - :ref:`sphx_glr_gallery_tree_plot_cogent3_layouts.py` (``../../gallery/tree/plot_cogent3_layouts.py``)
|
|
150
156
|
- 00:00.000
|
|
151
157
|
- 0.0
|
|
@@ -161,9 +167,15 @@ Computation times
|
|
|
161
167
|
* - :ref:`sphx_glr_gallery_tree_plot_leafedges_and_cascades.py` (``../../gallery/tree/plot_leafedges_and_cascades.py``)
|
|
162
168
|
- 00:00.000
|
|
163
169
|
- 0.0
|
|
170
|
+
* - :ref:`sphx_glr_gallery_tree_plot_simpletreedataprovider.py` (``../../gallery/tree/plot_simpletreedataprovider.py``)
|
|
171
|
+
- 00:00.000
|
|
172
|
+
- 0.0
|
|
164
173
|
* - :ref:`sphx_glr_gallery_tree_plot_skbio_tree.py` (``../../gallery/tree/plot_skbio_tree.py``)
|
|
165
174
|
- 00:00.000
|
|
166
175
|
- 0.0
|
|
176
|
+
* - :ref:`sphx_glr_gallery_tree_plot_support.py` (``../../gallery/tree/plot_support.py``)
|
|
177
|
+
- 00:00.000
|
|
178
|
+
- 0.0
|
|
167
179
|
* - :ref:`sphx_glr_gallery_tree_plot_tree_node_background.py` (``../../gallery/tree/plot_tree_node_background.py``)
|
|
168
180
|
- 00:00.000
|
|
169
181
|
- 0.0
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
Animations
|
|
3
3
|
==========
|
|
4
4
|
|
|
5
|
-
This tutorial shows how to animate `iplotx` visualizations using
|
|
5
|
+
This tutorial shows how to animate `iplotx` visualizations using
|
|
6
|
+
`matplotlib.animation.FuncAnimation`.
|
|
6
7
|
|
|
7
|
-
For illustration purposes, we will animate a simple directed graph,
|
|
8
|
+
For illustration purposes, we will animate a simple directed graph,
|
|
9
|
+
rotating it around its center. We also modify the opacity of the
|
|
10
|
+
vertices and edges, just for fun.
|
|
8
11
|
"""
|
|
9
12
|
|
|
10
13
|
import matplotlib.pyplot as plt
|
|
@@ -2,10 +2,17 @@
|
|
|
2
2
|
Chess masters
|
|
3
3
|
=============
|
|
4
4
|
|
|
5
|
-
This example from networkx shows the relatinoships between chess masters.
|
|
5
|
+
This example from networkx shows the relatinoships between chess masters.
|
|
6
|
+
The example has a lot of network analysis code that is somewhat irrelevant
|
|
7
|
+
for `iplotx` and is kept to demonstrate functional parity.
|
|
6
8
|
|
|
7
9
|
.. note::
|
|
8
|
-
The layout of this graph is computed with the Kamada-Kawai algorithm. In
|
|
10
|
+
The layout of this graph is computed with the Kamada-Kawai algorithm. In
|
|
11
|
+
networkx, that requires the `scipy` package to be installed. Here, we
|
|
12
|
+
also demonstrate the alternative, which is to convert the network to
|
|
13
|
+
`igraph`, which has an internal implementation of the algorithm. While
|
|
14
|
+
the exact layout is not identical, it is equally accurate and visually
|
|
15
|
+
similar.
|
|
9
16
|
"""
|
|
10
17
|
|
|
11
18
|
import numpy as np
|
|
@@ -52,9 +59,7 @@ def chess_pgn_graph(pgn_file="data/chess_masters_WCC.pgn.bz2"):
|
|
|
52
59
|
|
|
53
60
|
G = chess_pgn_graph()
|
|
54
61
|
|
|
55
|
-
print(
|
|
56
|
-
f"Loaded {G.number_of_edges()} chess games between {G.number_of_nodes()} players\n"
|
|
57
|
-
)
|
|
62
|
+
print(f"Loaded {G.number_of_edges()} chess games between {G.number_of_nodes()} players\n")
|
|
58
63
|
|
|
59
64
|
# identify connected components of the undirected version
|
|
60
65
|
H = G.to_undirected()
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
Editing artists after plotting
|
|
3
3
|
==============================
|
|
4
4
|
|
|
5
|
-
One of the strengths of `iplotx` is the support for editing artists after
|
|
5
|
+
One of the strengths of `iplotx` is the support for editing artists after
|
|
6
|
+
they have been plotted the first time without making a whole new figure.
|
|
6
7
|
|
|
7
|
-
In this example, we will change vertices, edges, arrows, etc. and check
|
|
8
|
+
In this example, we will change vertices, edges, arrows, etc. and check
|
|
9
|
+
out how they look like.
|
|
8
10
|
"""
|
|
9
11
|
|
|
10
12
|
# %%
|
|
11
13
|
# This is the vanilla version, taken from the "Ports" gallery example:
|
|
12
14
|
|
|
13
15
|
import igraph as ig
|
|
14
|
-
import numpy as np
|
|
15
|
-
import matplotlib.pyplot as plt
|
|
16
16
|
import iplotx as ipx
|
|
17
17
|
|
|
18
18
|
g = ig.Graph.Ring(3, directed=True)
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Grouping
|
|
3
3
|
========
|
|
4
4
|
|
|
5
|
-
This example shows how to use the `grouping` argument to visualise vertex
|
|
5
|
+
This example shows how to use the `grouping` argument to visualise vertex
|
|
6
|
+
covers or clustering, including singletons (i.e. groups of one vertex).
|
|
6
7
|
|
|
7
|
-
The function takes a few different formats for the groups, but the easiest
|
|
8
|
+
The function takes a few different formats for the groups, but the easiest
|
|
9
|
+
is a dictionary of sets, in which each key is the name of the group and
|
|
8
10
|
each value is the set of vertices in that group.
|
|
9
11
|
|
|
10
12
|
"""
|
|
@@ -15,7 +17,7 @@ import iplotx as ipx
|
|
|
15
17
|
|
|
16
18
|
g = ig.Graph.Ring(8)
|
|
17
19
|
|
|
18
|
-
ipx.
|
|
20
|
+
ipx.network(
|
|
19
21
|
network=g,
|
|
20
22
|
layout="circle",
|
|
21
23
|
grouping={
|
|
@@ -28,11 +30,13 @@ plt.gca().set_aspect(1.0)
|
|
|
28
30
|
|
|
29
31
|
# %%
|
|
30
32
|
# .. note::
|
|
31
|
-
# Group layouts are computed as rounded convex hulls around each group of vertices.
|
|
33
|
+
# Group layouts are computed as rounded convex hulls around each group of vertices.
|
|
34
|
+
# If you are interested in contributing an algorithm that computes concave group
|
|
35
|
+
# layouts, please reach out on GitHub!
|
|
32
36
|
#
|
|
33
37
|
# Groups can be styles in a similar way as all other elements in `iplotx`:
|
|
34
38
|
|
|
35
|
-
ipx.
|
|
39
|
+
ipx.network(
|
|
36
40
|
network=g,
|
|
37
41
|
layout="circle",
|
|
38
42
|
grouping={
|
|
@@ -61,7 +65,7 @@ plt.gca().set_aspect(1.0)
|
|
|
61
65
|
|
|
62
66
|
layout = g.layout("circle")
|
|
63
67
|
fig, ax = plt.subplots(figsize=(5, 5))
|
|
64
|
-
ipx.
|
|
68
|
+
ipx.network(
|
|
65
69
|
network=g,
|
|
66
70
|
layout=layout,
|
|
67
71
|
ax=ax,
|
|
@@ -70,7 +74,7 @@ ipx.plot(
|
|
|
70
74
|
vertex_label_color="white",
|
|
71
75
|
zorder=2,
|
|
72
76
|
)
|
|
73
|
-
ipx.
|
|
77
|
+
ipx.network(
|
|
74
78
|
grouping={
|
|
75
79
|
"singleton": {0},
|
|
76
80
|
"doublet": {1, 2},
|
|
@@ -87,6 +91,7 @@ ipx.plot(
|
|
|
87
91
|
|
|
88
92
|
# %%
|
|
89
93
|
# .. note::
|
|
90
|
-
# The argument `zorder` is applied to both network and grouping style, however
|
|
91
|
-
#
|
|
94
|
+
# The argument `zorder` is applied to both network and grouping style, however
|
|
95
|
+
# since only one of them is plotted each time this is equivalent to setting
|
|
96
|
+
# `network_zorder` and `grouping_zorder`. If both are specified, `zorder` takes
|
|
92
97
|
# priority over its more specific cousins.
|
|
@@ -11,9 +11,7 @@ import iplotx as ipx
|
|
|
11
11
|
|
|
12
12
|
G = nx.house_graph()
|
|
13
13
|
fig, ax = plt.subplots()
|
|
14
|
-
nx.set_node_attributes(
|
|
15
|
-
G, {0: (0, 0), 1: (1, 0), 2: (0, 1), 3: (1, 1), 4: (0.5, 2.0)}, "pos"
|
|
16
|
-
)
|
|
14
|
+
nx.set_node_attributes(G, {0: (0, 0), 1: (1, 0), 2: (0, 1), 3: (1, 1), 4: (0.5, 2.0)}, "pos")
|
|
17
15
|
nx.set_node_attributes(
|
|
18
16
|
G,
|
|
19
17
|
{
|
|
@@ -6,7 +6,6 @@ This minimal example shows how to style a plot in a few different ways.
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import networkx as nx
|
|
9
|
-
import matplotlib.pyplot as plt
|
|
10
9
|
import iplotx as ipx
|
|
11
10
|
|
|
12
11
|
# Create a graph and add a self-loop to node 0
|
|
@@ -22,7 +21,7 @@ G.add_edges_from(edgelist)
|
|
|
22
21
|
# Style the edge lines
|
|
23
22
|
linestyle = {e: "-" if e not in edgelist else "--" for e in G.edges()}
|
|
24
23
|
|
|
25
|
-
ipx.
|
|
24
|
+
ipx.network(
|
|
26
25
|
G,
|
|
27
26
|
layout=pos,
|
|
28
27
|
vertex_labels=True,
|
|
@@ -47,11 +46,11 @@ ipx.plot(
|
|
|
47
46
|
)
|
|
48
47
|
|
|
49
48
|
# %%
|
|
50
|
-
# In addition to fully structured styles in the form of nested dictionaries,
|
|
51
|
-
# also accepts flat or semi-flat styles, with levels separated by
|
|
52
|
-
# The above is equivalent to:
|
|
49
|
+
# In addition to fully structured styles in the form of nested dictionaries,
|
|
50
|
+
# `iplotx` also accepts flat or semi-flat styles, with levels separated by
|
|
51
|
+
# underscores ("_"). The above is equivalent to:
|
|
53
52
|
|
|
54
|
-
ipx.
|
|
53
|
+
ipx.network(
|
|
55
54
|
G,
|
|
56
55
|
layout=pos,
|
|
57
56
|
vertex_labels=True,
|
|
@@ -71,7 +70,7 @@ ipx.plot(
|
|
|
71
70
|
# The `**kwargs` flexible argument of `ipx.plotting` can be used for this purpose as well,
|
|
72
71
|
# for increased readability:
|
|
73
72
|
|
|
74
|
-
ipx.
|
|
73
|
+
ipx.network(
|
|
75
74
|
G,
|
|
76
75
|
layout=pos,
|
|
77
76
|
vertex_labels=True,
|
|
@@ -98,7 +97,7 @@ with ipx.style.context(
|
|
|
98
97
|
edge_looptension=3.5,
|
|
99
98
|
edge_arrow_marker="|>",
|
|
100
99
|
):
|
|
101
|
-
ipx.
|
|
100
|
+
ipx.network(
|
|
102
101
|
G,
|
|
103
102
|
layout=pos,
|
|
104
103
|
vertex_labels=True,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Maximum Bipartite Matching by Maximum Flow
|
|
3
3
|
==========================================
|
|
4
4
|
|
|
5
|
-
This example from `igraph` presents how to visualise bipartite matching
|
|
5
|
+
This example from `igraph` presents how to visualise bipartite matching
|
|
6
|
+
using maximum flow, with edge linewidth and vertex facecolor styling.
|
|
6
7
|
|
|
7
8
|
"""
|
|
8
9
|
|
|
9
10
|
import igraph as ig
|
|
10
|
-
import matplotlib.pyplot as plt
|
|
11
11
|
import iplotx as ipx
|
|
12
12
|
|
|
13
13
|
# We start by creating the bipartite directed graph.
|
|
@@ -37,7 +37,7 @@ layout = g.layout_bipartite()
|
|
|
37
37
|
layout[9] = (2, -1)
|
|
38
38
|
layout[10] = (2, 2)
|
|
39
39
|
|
|
40
|
-
ipx.
|
|
40
|
+
ipx.network(
|
|
41
41
|
g,
|
|
42
42
|
layout=layout,
|
|
43
43
|
vertex_labels=True,
|
|
@@ -57,7 +57,7 @@ ipx.plot(
|
|
|
57
57
|
# vertex style accordingly, perhaps with pronounced vertex borders to
|
|
58
58
|
# increase constrast:
|
|
59
59
|
#
|
|
60
|
-
ipx.
|
|
60
|
+
ipx.network(
|
|
61
61
|
g,
|
|
62
62
|
layout=layout,
|
|
63
63
|
vertex_labels=True,
|
|
@@ -7,7 +7,6 @@ This example from igraph shows how to work with edge labels and linewidths.
|
|
|
7
7
|
|
|
8
8
|
import random
|
|
9
9
|
import igraph as ig
|
|
10
|
-
import matplotlib.pyplot as plt
|
|
11
10
|
import iplotx as ipx
|
|
12
11
|
|
|
13
12
|
|
|
@@ -24,7 +23,7 @@ g.es[mst_edges]["width"] = 3.0
|
|
|
24
23
|
|
|
25
24
|
layout = g.layout("grid")
|
|
26
25
|
|
|
27
|
-
ipx.
|
|
26
|
+
ipx.network(
|
|
28
27
|
g,
|
|
29
28
|
layout=layout,
|
|
30
29
|
edge_labels=g.es["weight"],
|
|
@@ -48,10 +47,11 @@ ipx.plot(
|
|
|
48
47
|
)
|
|
49
48
|
|
|
50
49
|
# %%
|
|
51
|
-
# If you want to avoid rotating the labels vertically and let them follow the
|
|
52
|
-
# just set the "rotate" parameter to False (or skip
|
|
50
|
+
# If you want to avoid rotating the labels vertically and let them follow the
|
|
51
|
+
# edge directions instead, just set the "rotate" parameter to False (or skip
|
|
52
|
+
# it in the default style):
|
|
53
53
|
|
|
54
|
-
ipx.
|
|
54
|
+
ipx.network(
|
|
55
55
|
g,
|
|
56
56
|
layout=layout,
|
|
57
57
|
edge_labels=g.es["weight"],
|
|
@@ -12,7 +12,6 @@ This example shows how to interact with mouse events (e.g. hovering) in `iplotx`
|
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
14
|
import matplotlib.pyplot as plt
|
|
15
|
-
import numpy as np
|
|
16
15
|
import igraph as ig
|
|
17
16
|
import iplotx as ipx
|
|
18
17
|
|
|
@@ -48,7 +47,7 @@ def hover_callback(event):
|
|
|
48
47
|
if cont:
|
|
49
48
|
i = ind["ind"][0]
|
|
50
49
|
annot.xy = vc.get_offsets()[i]
|
|
51
|
-
annot.set_text(f"{i+1}")
|
|
50
|
+
annot.set_text(f"{i + 1}")
|
|
52
51
|
annot.set_visible(True)
|
|
53
52
|
# Otherwise, hide the bubble
|
|
54
53
|
elif annot.get_visible():
|
|
@@ -2,23 +2,27 @@
|
|
|
2
2
|
Edge ports
|
|
3
3
|
==========
|
|
4
4
|
|
|
5
|
-
This example demonstrates how to use **ports**, which specify at which angle
|
|
5
|
+
This example demonstrates how to use **ports**, which specify at which angle
|
|
6
|
+
edges exit from and enter into vertices.
|
|
6
7
|
|
|
7
|
-
Port directions are single or double letters borrowed from geography:
|
|
8
|
+
Port directions are single or double letters borrowed from geography:
|
|
9
|
+
`n` (north or up), `s` (south or down), `e` (east or right), `w` (west or left).
|
|
10
|
+
`nw` (north-west) and similar directions are also allowed.
|
|
8
11
|
|
|
9
|
-
Each edge has two ports, one for its exit from the source vertex, and one for
|
|
12
|
+
Each edge has two ports, one for its exit from the source vertex, and one for
|
|
13
|
+
its entry into the target vertex. For undirected graphs, these refer to the
|
|
14
|
+
order in the graph data structure.
|
|
10
15
|
|
|
11
16
|
If only one port is needed, you can set the other one to `None`.
|
|
12
17
|
"""
|
|
13
18
|
|
|
14
19
|
import igraph as ig
|
|
15
|
-
import numpy as np
|
|
16
20
|
import matplotlib.pyplot as plt
|
|
17
21
|
import iplotx as ipx
|
|
18
22
|
|
|
19
23
|
g = ig.Graph.Ring(3, directed=True)
|
|
20
24
|
|
|
21
|
-
ipx.
|
|
25
|
+
ipx.network(
|
|
22
26
|
g,
|
|
23
27
|
layout="circle",
|
|
24
28
|
edge_curved=True,
|
|
@@ -32,10 +36,11 @@ ipx.plot(
|
|
|
32
36
|
)
|
|
33
37
|
|
|
34
38
|
# %%
|
|
35
|
-
# Ports react to inversion of the x- or y-axis and set of axis limits from
|
|
39
|
+
# Ports react to inversion of the x- or y-axis and set of axis limits from
|
|
40
|
+
# positive to negatives, e.g.:
|
|
36
41
|
|
|
37
42
|
fig, ax = plt.subplots()
|
|
38
|
-
ipx.
|
|
43
|
+
ipx.network(
|
|
39
44
|
g,
|
|
40
45
|
ax=ax,
|
|
41
46
|
layout="circle",
|
|
@@ -52,11 +57,12 @@ ax.invert_xaxis()
|
|
|
52
57
|
ax.invert_yaxis()
|
|
53
58
|
|
|
54
59
|
# %%
|
|
55
|
-
# is the mirror image (in both x and y) of the previous plot. Here's the same
|
|
60
|
+
# is the mirror image (in both x and y) of the previous plot. Here's the same
|
|
61
|
+
# example but setting some ports to None:
|
|
56
62
|
|
|
57
63
|
g = ig.Graph.Ring(3, directed=True)
|
|
58
64
|
|
|
59
|
-
ipx.
|
|
65
|
+
ipx.network(
|
|
60
66
|
g,
|
|
61
67
|
layout="circle",
|
|
62
68
|
edge_curved=True,
|
|
@@ -37,9 +37,7 @@ nx.set_edge_attributes(
|
|
|
37
37
|
{
|
|
38
38
|
(u, v): {
|
|
39
39
|
"color": (
|
|
40
|
-
"red"
|
|
41
|
-
if (u, v) in path_edges or tuple(reversed((u, v))) in path_edges
|
|
42
|
-
else "black"
|
|
40
|
+
"red" if (u, v) in path_edges or tuple(reversed((u, v))) in path_edges else "black"
|
|
43
41
|
),
|
|
44
42
|
"label": d["weight"],
|
|
45
43
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Simple example from networkx
|
|
3
3
|
============================
|
|
4
4
|
|
|
5
|
-
This example demonstrates how to use `iplotx` with `networkx`. Note how the
|
|
5
|
+
This example demonstrates how to use `iplotx` with `networkx`. Note how the
|
|
6
|
+
vertex size is computed dynamically based on label size.
|
|
6
7
|
"""
|
|
7
8
|
|
|
8
9
|
import networkx as nx
|
|
@@ -20,7 +21,7 @@ G.add_edge(4, 5)
|
|
|
20
21
|
# explicitly set positions
|
|
21
22
|
pos = {1: (0, 0), 2: (-1, 0.3), 3: (2, 0.17), 4: (4, 0.255), 5: (5, 0.03)}
|
|
22
23
|
|
|
23
|
-
ipx.
|
|
24
|
+
ipx.network(
|
|
24
25
|
G,
|
|
25
26
|
layout=pos,
|
|
26
27
|
vertex_labels=True,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Zero
|
|
3
|
-
|
|
2
|
+
Zero-dependency networks
|
|
3
|
+
========================
|
|
4
4
|
|
|
5
|
-
This example uses `iplotx`'s internal `
|
|
5
|
+
This example uses `iplotx`'s internal `SimpleNetworkDataProvider` to show how to visualise
|
|
6
6
|
networkx without using any external analysis library (e.g. `igraph`, `networkx`).
|
|
7
7
|
"""
|
|
8
8
|
|
|
@@ -5,7 +5,8 @@ Basics of styling
|
|
|
5
5
|
This example shows a few simple styling options available in `iplotx`.
|
|
6
6
|
|
|
7
7
|
.. tip::
|
|
8
|
-
`iplotx` has an internal library of styles. See the :doc:`plot_multistyle`
|
|
8
|
+
`iplotx` has an internal library of styles. See the :doc:`plot_multistyle`
|
|
9
|
+
example.
|
|
9
10
|
"""
|
|
10
11
|
|
|
11
12
|
import igraph as ig
|
|
@@ -26,10 +27,11 @@ style = {
|
|
|
26
27
|
},
|
|
27
28
|
}
|
|
28
29
|
fig, ax = plt.subplots(figsize=(3, 3))
|
|
29
|
-
ipx.
|
|
30
|
+
ipx.network(g, ax=ax, layout=layout, style=style)
|
|
30
31
|
|
|
31
32
|
# %%
|
|
32
|
-
# You can also **chain styles**. For example, you can apply an existing
|
|
33
|
+
# You can also **chain styles**. For example, you can apply an existing
|
|
34
|
+
# style first, and then modify it with a custom dictionary:
|
|
33
35
|
|
|
34
36
|
style = {
|
|
35
37
|
"edge": {
|
|
@@ -37,7 +39,7 @@ style = {
|
|
|
37
39
|
},
|
|
38
40
|
}
|
|
39
41
|
fig, ax = plt.subplots(figsize=(3, 3))
|
|
40
|
-
ipx.
|
|
42
|
+
ipx.network(
|
|
41
43
|
g,
|
|
42
44
|
ax=ax,
|
|
43
45
|
layout=layout,
|
|
@@ -45,5 +47,5 @@ ipx.plot(
|
|
|
45
47
|
)
|
|
46
48
|
|
|
47
49
|
# %%
|
|
48
|
-
# As you can see, the network is visualised with the "rededge" style (which
|
|
49
|
-
# but further modified to have dashed lines.
|
|
50
|
+
# As you can see, the network is visualised with the "rededge" style (which
|
|
51
|
+
# has red, solid edges) but further modified to have dashed lines.
|
|
@@ -31,8 +31,7 @@ for i in range(len(pos)):
|
|
|
31
31
|
cycle = nx_app.christofides(G, weight="weight")
|
|
32
32
|
edge_list = list(nx.utils.pairwise(cycle))
|
|
33
33
|
edge_color = {
|
|
34
|
-
tuple(e): "red" if e in edge_list or e[::-1] in edge_list else "none"
|
|
35
|
-
for e in G.edges()
|
|
34
|
+
tuple(e): "red" if e in edge_list or e[::-1] in edge_list else "none" for e in G.edges()
|
|
36
35
|
}
|
|
37
36
|
nx.set_edge_attributes(G, edge_color, "color")
|
|
38
37
|
|