iplotx 0.3.1__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.3.1 → iplotx-0.5.0}/.github/workflows/test.yml +5 -2
- iplotx-0.5.0/.pre-commit-config.yaml +54 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/MANIFEST.in +0 -1
- {iplotx-0.3.1 → iplotx-0.5.0}/PKG-INFO +2 -1
- {iplotx-0.3.1 → iplotx-0.5.0}/README.md +1 -0
- iplotx-0.3.1/docs/source/api.md → iplotx-0.5.0/docs/source/api/artists.md +1 -37
- iplotx-0.5.0/docs/source/api/complete_style_specification.md +254 -0
- iplotx-0.5.0/docs/source/api/plotting.md +13 -0
- iplotx-0.5.0/docs/source/api/providers.md +16 -0
- iplotx-0.5.0/docs/source/api/style.md +23 -0
- iplotx-0.5.0/docs/source/api.md +7 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/docs/source/conf.py +1 -2
- {iplotx-0.3.1 → iplotx-0.5.0}/docs/source/index.md +6 -0
- iplotx-0.5.0/docs/source/providers.md +72 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/docs/source/sg_execution_times.rst +58 -13
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/GALLERY_HEADER.rst +3 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_animation.py +5 -2
- iplotx-0.5.0/gallery/plot_arrows.py +31 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_chess_masters.py +11 -6
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_dag.py +0 -1
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_edit_artists.py +4 -4
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_grouping.py +14 -9
- iplotx-0.5.0/gallery/plot_halfarrows.py +65 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_house.py +1 -3
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_knuth_miles.py +1 -2
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_loops.py +7 -8
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_max_bipartite_matching.py +4 -4
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_minimum_spanning_trees.py +5 -5
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_mouse_hover.py +1 -2
- iplotx-0.5.0/gallery/plot_multistyle.py +59 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_ports.py +15 -9
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_shortest_path.py +1 -3
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_simple_networkx.py +3 -2
- iplotx-0.5.0/gallery/plot_simplenetworkdataprovider.py +28 -0
- iplotx-0.5.0/gallery/plot_style.py +51 -0
- iplotx-0.5.0/gallery/plot_tension.py +79 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_traveling_salesman.py +1 -2
- iplotx-0.5.0/gallery/plot_vertexmarkers.py +49 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_voronoi.py +5 -1
- iplotx-0.5.0/gallery/tree/GALLERY_HEADER.rst +6 -0
- iplotx-0.5.0/gallery/tree/data/tree-with-support.json +1 -0
- iplotx-0.5.0/gallery/tree/plot_angular_waypoints.py +87 -0
- {iplotx-0.3.1/gallery → iplotx-0.5.0/gallery/tree}/plot_biopython_tree.py +5 -4
- iplotx-0.5.0/gallery/tree/plot_cladeedges.py +38 -0
- iplotx-0.5.0/gallery/tree/plot_cogent3_layouts.py +72 -0
- {iplotx-0.3.1/gallery → iplotx-0.5.0/gallery/tree}/plot_cogent3_tree.py +1 -1
- {iplotx-0.3.1/gallery → iplotx-0.5.0/gallery/tree}/plot_ete4.py +8 -3
- iplotx-0.5.0/gallery/tree/plot_leafedges.py +49 -0
- iplotx-0.5.0/gallery/tree/plot_leafedges_and_cascades.py +36 -0
- 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.5.0/gallery/tree/plot_support.py +54 -0
- iplotx-0.5.0/gallery/tree/plot_tree_node_background.py +109 -0
- iplotx-0.5.0/gallery/tree/plot_tree_style_clades.py +58 -0
- {iplotx-0.3.1/gallery → iplotx-0.5.0/gallery/tree}/plot_trees_of_trees.py +1 -2
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/__init__.py +5 -0
- iplotx-0.5.0/iplotx/artists.py +24 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/cascades.py +22 -31
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/edge/__init__.py +122 -49
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/edge/arrow.py +44 -3
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/edge/geometry.py +30 -21
- iplotx-0.5.0/iplotx/edge/leaf.py +117 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/edge/ports.py +3 -2
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/groups.py +1 -3
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/ingest/__init__.py +6 -20
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/ingest/heuristics.py +4 -36
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/ingest/providers/network/igraph.py +20 -18
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/ingest/providers/network/networkx.py +20 -24
- iplotx-0.5.0/iplotx/ingest/providers/network/simple.py +114 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/ingest/providers/tree/biopython.py +15 -5
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/ingest/providers/tree/cogent3.py +9 -5
- {iplotx-0.3.1 → 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.3.1 → iplotx-0.5.0}/iplotx/ingest/providers/tree/skbio.py +2 -5
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/ingest/typing.py +109 -19
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/label.py +42 -12
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/layout.py +5 -1
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/network.py +69 -18
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/plotting.py +9 -9
- iplotx-0.3.1/iplotx/style.py → iplotx-0.5.0/iplotx/style/__init__.py +150 -187
- iplotx-0.5.0/iplotx/style/leaf_info.py +44 -0
- iplotx-0.5.0/iplotx/style/library.py +324 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/tree.py +279 -51
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/typing.py +2 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/utils/geometry.py +32 -40
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/utils/matplotlib.py +43 -22
- iplotx-0.5.0/iplotx/utils/style.py +17 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/version.py +1 -1
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/vertex.py +63 -15
- {iplotx-0.3.1 → 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.3.1 → 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.3.1 → 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.3.1 → 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.3.1 → iplotx-0.5.0}/tests/test_skbio.py +4 -10
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/test_style.py +16 -8
- iplotx-0.5.0/tests/test_vertex.py +216 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/utils.py +5 -7
- {iplotx-0.3.1 → iplotx-0.5.0}/uv.lock +116 -0
- iplotx-0.3.1/gallery/plot_style.py +0 -29
- iplotx-0.3.1/gallery/plot_tree_node_background.py +0 -55
- iplotx-0.3.1/iplotx/utils/style.py +0 -1
- iplotx-0.3.1/tests/baseline_images/test_igraph/igraph_layout_object.png +0 -0
- iplotx-0.3.1/tests/test_biopython.py +0 -85
- iplotx-0.3.1/tests/test_ete4.py +0 -81
- {iplotx-0.3.1 → iplotx-0.5.0}/.github/workflows/publish.yml +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/.gitignore +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/.readthedocs.yaml +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/LICENSE +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/assets/pylint.svg +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/docs/Makefile +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/docs/make.bat +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/docs/source/_static/graph_basic.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/docs/source/_templates/layout.html +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/docs/source/images/sphx_glr_plot_basic_001.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/docs/source/images/thumb/sphx_glr_plot_basic_thumb.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/docs/source/style.md +0 -0
- {iplotx-0.3.1/gallery → iplotx-0.5.0/gallery/data}/chess_masters_WCC.pgn.bz2 +0 -0
- {iplotx-0.3.1/gallery → iplotx-0.5.0/gallery/data}/knuth_miles.txt.gz +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_basic.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_big_curves.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_cliques.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_cluster_layout.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_company_structure.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_complex.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_directed.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_four_grids.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_labels_and_colors.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_multipartite_layout.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_parallel_igraph_networkx.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_simple_path.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/gallery/plot_with_colorbar.py +0 -0
- {iplotx-0.3.1/gallery → iplotx-0.5.0/gallery/tree}/plot_skbio_tree.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/iplotx/utils/internal.py +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/scripts/copy_github_release_into_version.sh +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/scripts/update_pylint_badge.sh +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_biopython/leaf_labels.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_biopython/leaf_labels_hmargin.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_biopython/tree_basic.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_biopython/tree_radial.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_cogent3/leaf_labels.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_cogent3/leaf_labels_hmargin.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_cogent3/tree_basic.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_cogent3/tree_radial.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_ete4/leaf_labels.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_ete4/leaf_labels_hmargin.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_ete4/tree_basic.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_ete4/tree_radial.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_igraph/clustering_directed.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_igraph/clustering_directed_large.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_basic.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_directed.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_directed_curved_loops.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_edit_children.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_labels.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_layout_attribute.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_null.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_igraph/graph_squares_directed.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_igraph/multigraph_with_curved_edges_undirected.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_networkx/cluster-layout.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_networkx/complex.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_networkx/directed_graph.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_networkx/directed_graph_with_colorbar.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_networkx/empty_graph.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_networkx/flat_style.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_networkx/house_with_colors.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_networkx/labels_and_colors.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_networkx/shortest_path.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_networkx/simple_graph.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_skbio/leaf_labels.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_skbio/leaf_labels_hmargin.png +0 -0
- {iplotx-0.3.1 → iplotx-0.5.0}/tests/baseline_images/test_skbio/tree_basic.png +0 -0
- {iplotx-0.3.1 → 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
|
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
#
|
|
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
|
|
1
|
+
# Artist hierarchy
|
|
38
2
|
`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
3
|
|
|
40
4
|
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.
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# Complete style specification
|
|
2
|
+
```{note}
|
|
3
|
+
There might be additional matplotlib options not mentioned below (e.g. rotation,
|
|
4
|
+
font family). Any options not mentioned below are passed directly to matplotlib.
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
```python
|
|
9
|
+
{
|
|
10
|
+
# Vertex style
|
|
11
|
+
"vertex": {
|
|
12
|
+
# Size of the vertex in points. If a pair, it indicates width and height
|
|
13
|
+
# of the marker. If "label", set the size dynamically based on the vertex
|
|
14
|
+
# label (a label is needed in this case)
|
|
15
|
+
"size": float | tuple[float, float] | str,
|
|
16
|
+
|
|
17
|
+
# Marker style. Currently supported markers:
|
|
18
|
+
# o, c, circle: circle
|
|
19
|
+
# s, square, r, rectangle: rectangle (square if only one size specified)
|
|
20
|
+
# ^, triangle: upward triangle
|
|
21
|
+
# v, triangle_down: downward triangle
|
|
22
|
+
# <, triangle_left: leftward triangle
|
|
23
|
+
# >, triangle_right: rightward triangle
|
|
24
|
+
# d, diamond: diamond
|
|
25
|
+
# e, ellipse: ellipse
|
|
26
|
+
# p, pentagon: pentagon
|
|
27
|
+
# h, hexagon: hexagon
|
|
28
|
+
# 8, octagon: octagon
|
|
29
|
+
# *, star: 5-point star, upright
|
|
30
|
+
"marker": str,
|
|
31
|
+
|
|
32
|
+
"facecolor": str | Any, # Color of the vertex face (e.g. 'red', '#FF0000')
|
|
33
|
+
"edgecolor": str | Any, # Color of the vertex edge (e.g. 'black', '#000000')
|
|
34
|
+
"alpha": float, # Opacity of the vertex (0.0 for fully transparent, 1.0 for fully opaque)
|
|
35
|
+
|
|
36
|
+
# Vertex label style
|
|
37
|
+
"label": {
|
|
38
|
+
"color": str | Any, # Color of the vertex label (e.g. 'white', '#FFFFFF')
|
|
39
|
+
"horizontalalignment": str, # Horizontal alignment of the label ('left', 'center', 'right')
|
|
40
|
+
"verticalalignment": str, # Vertical alignment of the label ('top', 'center', 'bottom', 'baseline', 'center_baseline')
|
|
41
|
+
"hpadding": float, # Horizontal padding around the label
|
|
42
|
+
"vpadding": float, # Vertical padding around the label
|
|
43
|
+
|
|
44
|
+
# Bounding box properties for the label
|
|
45
|
+
"bbox": {
|
|
46
|
+
"boxstyle": str, # Style of the bounding box ('round', 'square', etc.)
|
|
47
|
+
"facecolor": str | Any, # Color of the bounding box (e.g. 'yellow', '#FFFF00')
|
|
48
|
+
"edgecolor": str | Any, # Color of the bounding box edge (e.g. 'black', '#000000')
|
|
49
|
+
... # Any other bounding box property
|
|
50
|
+
|
|
51
|
+
},
|
|
52
|
+
"hmargin": float, # Horizontal margin around (usually left of) the label
|
|
53
|
+
"vmargin": float, # Vertical margin around (usually below) the label. Rarely used.
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
# Edge style
|
|
58
|
+
"edge": {
|
|
59
|
+
"linewidth": float, # Width of the edge line in points
|
|
60
|
+
|
|
61
|
+
# Style of the edge line ('-' for solid, '--' for dashed, etc.). Matplotlib
|
|
62
|
+
# allows for quite flexible syntax here.
|
|
63
|
+
"linestyle": str | Any,
|
|
64
|
+
|
|
65
|
+
# Color of the edge line (e.g. 'blue', '#0000FF'). This can be a floating
|
|
66
|
+
# number (usually set on a per-edge basis) to use color mapping. In that case
|
|
67
|
+
# the "cmap" property needs to be set too (see next option). In that case,
|
|
68
|
+
# the min/max values of the floats are used as extremes for the colormap,
|
|
69
|
+
# unless the "norm" option is used.
|
|
70
|
+
"color": str | float | Any,
|
|
71
|
+
|
|
72
|
+
# Matplotlib color map used to map floating numbers into RGBA colors. Only
|
|
73
|
+
# used when the previous option "color" is set to floats.
|
|
74
|
+
"cmap": str | matplotlib.colors.Colormap,
|
|
75
|
+
|
|
76
|
+
# Matplotlib norm to connect color map and edge floating-point color values.
|
|
77
|
+
# This is only used when colors are mapped through a color map. In that case,
|
|
78
|
+
# this option lets the user finely control what floating number will be mapped
|
|
79
|
+
# onto what color.
|
|
80
|
+
"norm": tuple[float, float] | matplotlib.colors.Normalize,
|
|
81
|
+
|
|
82
|
+
# Opacity of the vertex (0.0 for fully transparent, 1.0 for fully opaque).
|
|
83
|
+
# If a colormap is used and this option is also set, this opacity takes
|
|
84
|
+
# priority and finally determines the transparency of the edges.
|
|
85
|
+
"alpha": float,
|
|
86
|
+
|
|
87
|
+
"curved": bool, # Whether the edge is curved (True) or straight (False)
|
|
88
|
+
|
|
89
|
+
# Tension for curved edges (0.0 for straight, higher values position the
|
|
90
|
+
# Bezier control points further away from the nodes, creating more wiggly lines)
|
|
91
|
+
# Negative values bend the curve on the other side of the straight line.
|
|
92
|
+
"tension": float,
|
|
93
|
+
|
|
94
|
+
# Tension for self-loops (higher values create more bigger loops).
|
|
95
|
+
# This is typically a strictly positive value.
|
|
96
|
+
"looptension": float,
|
|
97
|
+
|
|
98
|
+
# The maximum angle for self-loops (in degrees). This is typically a positive
|
|
99
|
+
# number quite a bit less than 180 degrees to avoid funny-looking self-loops.
|
|
100
|
+
"loopmaxangle": float,
|
|
101
|
+
|
|
102
|
+
# xy offset of the edge coordinate in figure points. This is usually set on a
|
|
103
|
+
# per-edge basis if specific edges are to be shifted laterally slightly. Large
|
|
104
|
+
# offsets tend to not play well with the rest of the visualisation.
|
|
105
|
+
"offset": tuple[float, float],
|
|
106
|
+
|
|
107
|
+
# How much (in figure points) to offset parallel straight edges (i.e. in a
|
|
108
|
+
# multigraph only) along the orthogonal direction to make them more visible.
|
|
109
|
+
# To obtain a double-headed arrow effect, set this to zero. On the flip side,
|
|
110
|
+
# you will not know how many parallel edges there are between those two nodes.
|
|
111
|
+
"paralleloffset": float,
|
|
112
|
+
|
|
113
|
+
# Edge ports a la Graphviz, which indicate the attack angle of an edge into
|
|
114
|
+
# its origin (first element) and target (second element) node. "w" (for
|
|
115
|
+
# "west") means exiting from/entering into the left side, "e" is the right
|
|
116
|
+
# side, "n" the top, "s" the bottom. "nw" and similar two-letter combinations
|
|
117
|
+
# are accepted and indicate 45 degree angles (in figure space). None means
|
|
118
|
+
# that edge side is free (i.e. no special instruction there). This is almost
|
|
119
|
+
# universally either unset or set on a per-edge basis to finely control the
|
|
120
|
+
# appearance of the network (e.g. in organisational charts).
|
|
121
|
+
"ports": tuple[str | None, str | None],
|
|
122
|
+
|
|
123
|
+
# Edge waypoints. This option is usually set together with "ports" to
|
|
124
|
+
# finely control the appearance of edges. For trees, this option is used
|
|
125
|
+
# internally to create piecewise-straight connections. This option is
|
|
126
|
+
# currently experimental, but you can try the following settings:
|
|
127
|
+
# - xmidy0,xmidy1: Two waypoints with the mid-x and the 1st and 2nd y values.
|
|
128
|
+
# - ymidx0,ymidx1: The xy swap of the previous option.
|
|
129
|
+
# - x0y1: One waypoint, with x of the first point and y of the second point.
|
|
130
|
+
# - x1y0: The xy swap of the previous option.
|
|
131
|
+
# We are looking into ways to generalise this idea.
|
|
132
|
+
"waypoints": str,
|
|
133
|
+
|
|
134
|
+
# Edge arrow style for directed graphs
|
|
135
|
+
"arrow": {
|
|
136
|
+
# Arrow marker style. Currently supported:
|
|
137
|
+
# |>
|
|
138
|
+
# |/
|
|
139
|
+
# |\\ (double slash needed to avoid character escaping)
|
|
140
|
+
# >
|
|
141
|
+
# >>
|
|
142
|
+
# )>
|
|
143
|
+
# )
|
|
144
|
+
# |
|
|
145
|
+
# s
|
|
146
|
+
# d
|
|
147
|
+
# p
|
|
148
|
+
# q
|
|
149
|
+
"marker": str,
|
|
150
|
+
|
|
151
|
+
"width": float, # Width of the arrow in points
|
|
152
|
+
|
|
153
|
+
# Height of the arrow in points. Defaults to 1.3 times the width if not
|
|
154
|
+
# specified. If the string "width" is used, it is set to the width of
|
|
155
|
+
# the arrow.
|
|
156
|
+
"height": float | str,
|
|
157
|
+
|
|
158
|
+
# Color of the arrow (e.g. 'black', '#000000'). This means both the
|
|
159
|
+
# facecolor and edgecolor for full arrows (e.g. "|>"), only the edgecolor
|
|
160
|
+
# for hollow arrows (e.g. ">"). This specification, like in matplotlib,
|
|
161
|
+
# takes higher precedence than the "edgecolor" and "facecolor" properties.
|
|
162
|
+
# If this property is not specified, the color of the edge to which the
|
|
163
|
+
# arrowhead belongs to is used.
|
|
164
|
+
"color": str | Any,
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
# Edge label style
|
|
168
|
+
"label": {
|
|
169
|
+
|
|
170
|
+
# Whether to rotate edge labels to be horizontal (True) or to leave them
|
|
171
|
+
# parallel to their edge (False). Some users find this boolean
|
|
172
|
+
# unintuitive and interpret it the other way around, so think carefully.
|
|
173
|
+
"rotate": bool,
|
|
174
|
+
|
|
175
|
+
"color": str | Any, # Color of the vertex label (e.g. 'white', '#FFFFFF')
|
|
176
|
+
"horizontalalignment": str, # Horizontal alignment of the label ('left', 'center', 'right')
|
|
177
|
+
"verticalalignment": str, # Vertical alignment of the label ('top', 'center', 'bottom', 'baseline', 'center_baseline')
|
|
178
|
+
"hpadding": float, # Horizontal padding around the label
|
|
179
|
+
"vpadding": float, # Vertical padding around the label
|
|
180
|
+
"bbox": dict, # Bounding box properties for the label (see vertex labels)
|
|
181
|
+
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
# The following entry is used by networks ONLY (not trees as plotted by `iplotx.tree`)
|
|
186
|
+
"grouping": {
|
|
187
|
+
"facecolor": str | Any, # Color of the grouping face (e.g. 'lightgray', '#D3D3D3')
|
|
188
|
+
"edgecolor": str | Any, # Color of the grouping edge (e.g. 'gray', '#808080')
|
|
189
|
+
"linewidth": float, # Width of the grouping edge in points
|
|
190
|
+
"vertexpadding": float, # Padding around the vertices in the grouping in points
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
############################################################################
|
|
194
|
+
# The following entries are used by trees ONLY (as plotted by `iplotx.tree`)
|
|
195
|
+
"cascade": {
|
|
196
|
+
# Whether to limit the cascade to the deepest descendant (False),
|
|
197
|
+
# to the deepest leaf overall (True), or to include the leaf labels
|
|
198
|
+
# as well "leaf_labels"
|
|
199
|
+
"extend": bool | str,
|
|
200
|
+
|
|
201
|
+
"facecolor": str | Any, # Color of the cascade face
|
|
202
|
+
"edgecolor": str | Any, # Color of the cascade edge
|
|
203
|
+
"alpha": float, # Opacity of the cascade patch
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
# Leaf styles are currently only used for their labels
|
|
207
|
+
"leaf": {
|
|
208
|
+
# Whether leaf nodes and labels will be aligned to the deepest leaf.
|
|
209
|
+
# If False, each leaf label will be at the depth of its leaf.
|
|
210
|
+
"deep": bool,
|
|
211
|
+
"label": {
|
|
212
|
+
"color": str | Any, # Color of the label text
|
|
213
|
+
"hmargin": float, # Horizontal offset (before rotation) off the leaf node
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
# Leaf edge styles are used for the (usually dashed) lines connecting leaves
|
|
218
|
+
# at less-than-max depth to deep labels (if used).
|
|
219
|
+
"leafedge": {
|
|
220
|
+
"color": str | Any, # Color of the leaf edge (e.g. 'gray', '#808080')
|
|
221
|
+
"linewidth": float, # Width of the leaf edge in points
|
|
222
|
+
"linestyle": str | Any, # Style of the leaf edge line ('--' for dashed etc.)
|
|
223
|
+
|
|
224
|
+
# Leaf edge labels.
|
|
225
|
+
# NOTE: These lines will NOT exist for leaves that are set at the max depth
|
|
226
|
+
# (at least one leaf will always be skipped). Therefore, using labels here
|
|
227
|
+
# can be a little trickier than you might expect.
|
|
228
|
+
"label": {
|
|
229
|
+
"color": str | Any, # Color of the leaf edge label (e.g. 'black')
|
|
230
|
+
"hmargin": float, # Horizontal offset (before rotation) off the leaf edge
|
|
231
|
+
"vmargin": float, # Vertical offset (before rotation) off the leaf edge
|
|
232
|
+
# Whether to rotate the label to be horizontal (True) or parallel to the edge (False)
|
|
233
|
+
"rotate": bool,
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
# Layout options for trees
|
|
238
|
+
"layout": {
|
|
239
|
+
# Orientation of the tree. Accepted values depend on the tree layout:
|
|
240
|
+
# - "horizontal" layout: "left" or "right"
|
|
241
|
+
# - "vertical" layout: "ascending" or "descending"
|
|
242
|
+
# - "radial" layout: "clockwise" or "counterclockwise"
|
|
243
|
+
"orientation": str,
|
|
244
|
+
"angular": bool, # Whether to use an angular or waypoint-based layout
|
|
245
|
+
"start": float, # Starting angle for radial layouts (in degrees)
|
|
246
|
+
"span": float, # Angle span for radial layouts (in degrees)
|
|
247
|
+
},
|
|
248
|
+
############################################################################
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
```{tip}
|
|
253
|
+
Most options can be "leaf rotated" to obtain a per-vertex, per-edge, per-label, or per-cascade look. See <project:../style.md> for more info.
|
|
254
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Plotting API
|
|
2
|
+
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.
|
|
3
|
+
|
|
4
|
+
```{tip}
|
|
5
|
+
`iplotx.plot` is a synonym for `iplotx.network`.
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
```{eval-rst}
|
|
9
|
+
.. autofunction:: iplotx.network
|
|
10
|
+
:noindex:
|
|
11
|
+
|
|
12
|
+
.. autofunction:: iplotx.tree
|
|
13
|
+
:noindex:
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Data provider protocols
|
|
2
|
+
```{note}
|
|
3
|
+
The `NetworkDataProvider` protocol requires individual providers to implement `__call__` which actually processed the network, layout, and label data. We are working on simplifying this situation.
|
|
4
|
+
|
|
5
|
+
The `TreeDataProvider` protocol is simpler to implement as this function is standardised and needs not be implemented by individual providers. Only the support functions, which are very simple and small, needs to be implemented by tree providers.
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
```{eval-rst}
|
|
10
|
+
.. autoclass:: iplotx.ingest.typing.NetworkDataProvider
|
|
11
|
+
:members:
|
|
12
|
+
|
|
13
|
+
.. autoclass:: iplotx.ingest.typing.TreeDataProvider
|
|
14
|
+
:members:
|
|
15
|
+
|
|
16
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Styling
|
|
2
|
+
See also the <project:../style.md> page for an introduction to styles in `iplotx`. See also <project:complete_style_specification.md>.
|
|
3
|
+
|
|
4
|
+
## Functions
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
```{eval-rst}
|
|
8
|
+
.. autofunction:: iplotx.style.context
|
|
9
|
+
|
|
10
|
+
.. autofunction:: iplotx.style.use
|
|
11
|
+
|
|
12
|
+
.. autofunction:: iplotx.style.reset
|
|
13
|
+
|
|
14
|
+
.. autofunction:: iplotx.style.get_style
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The following functions are reported for completeness but are rarely used by users directly:
|
|
18
|
+
|
|
19
|
+
```{eval-rst}
|
|
20
|
+
.. autofunction:: iplotx.style.unflatten_style
|
|
21
|
+
|
|
22
|
+
.. autofunction:: iplotx.style.rotate_style
|
|
23
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Reference API
|
|
2
|
+
This is the reference documentation for `iplotx`. This is split into separate sections:
|
|
3
|
+
|
|
4
|
+
- <project:api/plotting.md> for the plotting API
|
|
5
|
+
- <project:api/style.md> for the styling API
|
|
6
|
+
- <project:api/artists.md> for the artist hierarchy
|
|
7
|
+
- <project:api/providers.md> for the data providers API
|
|
@@ -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")
|
|
@@ -116,5 +116,11 @@ We believe graph **analysis**, graph **layouting**, and graph **visualisation**
|
|
|
116
116
|
|
|
117
117
|
gallery/index
|
|
118
118
|
style
|
|
119
|
+
Data providers <providers>
|
|
119
120
|
API <api>
|
|
121
|
+
Plotting API <api/plotting>
|
|
122
|
+
Styling API <api/style>
|
|
123
|
+
Complete style specification <api/complete_style_specification>
|
|
124
|
+
Artist hierarchy <api/artists>
|
|
125
|
+
Data provider protocols <api/providers>
|
|
120
126
|
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Data Providers
|
|
2
|
+
Networks and trees can be represented in different data structures. For instance, in `igraph` nodes are ordered and numbered, while in `networkx` they are neither.
|
|
3
|
+
|
|
4
|
+
`iplotx` is designed to accept data of any kinds as long as it can understand how to
|
|
5
|
+
process it into a visualisation. This flexibility is achieved through **data providers**.
|
|
6
|
+
|
|
7
|
+
A **network data provider** is a class that satisfies the `NetworkDataProvider` protocol, i.e. it implements a few functions that help `iplotx` understand how to ingest
|
|
8
|
+
data.
|
|
9
|
+
|
|
10
|
+
Similarly, a **tree data provider** is a class that satisfies the `TreeDataProvider` protocol, i.e. it implements those few functions. It is the tree-specific equivalent of the previous case.
|
|
11
|
+
|
|
12
|
+
See <project:api/providers.md> for the exact protocols.
|
|
13
|
+
|
|
14
|
+
## An example: Simple network data provider
|
|
15
|
+
While `igraph`, `networkx` and the likes can be quite complicated, `iplotx` also provides a simple dict-based `NetworkDataProvider` for educational purposes. The network data structure in this case is the following:
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
network : dict[str, Sequence | bool] = {
|
|
19
|
+
"vertices": ["alice", "bob", "jago"],
|
|
20
|
+
"edges": [
|
|
21
|
+
("alice", "bob"),
|
|
22
|
+
("bob", "jago"),
|
|
23
|
+
("alice", "jago"),
|
|
24
|
+
],
|
|
25
|
+
"directed": False,
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
It is a simple dictionary with a key for vertices, one for edges, and one for directedness. Only the key for edges is required. If missing, directedness is assumed to be `False`. If vertices are missing, they are inferred from the edges (singletons will be missed - there are none in the example above).
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
A straightforward `NetworkDataProvider` implementation for this network data structure is found in `iplotx/ingest/providers/network/simple.py`. As a result, it is possible to ingest networks in this new format for visualisation:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import iplotx as ipx
|
|
36
|
+
network = {
|
|
37
|
+
"edges": [
|
|
38
|
+
("alice", "bob"),
|
|
39
|
+
("bob", "jago"),
|
|
40
|
+
("alice", "jago"),
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
layout = {
|
|
44
|
+
"alice": (0, 0),
|
|
45
|
+
"bob": (1, 1),
|
|
46
|
+
"jago": (1, 0),
|
|
47
|
+
}
|
|
48
|
+
ipx.plot(
|
|
49
|
+
network,
|
|
50
|
+
layout,
|
|
51
|
+
)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
See <project:gallery/plot_simpledataprovider.md> for the full gallery example including vertex labels and styling.
|
|
55
|
+
|
|
56
|
+
```{tip}
|
|
57
|
+
This example also shows how to use `iplotx` without installing any network analysis
|
|
58
|
+
library. You'll still need `matplotlib` for plotting and `numpy` and `pandas` for
|
|
59
|
+
internal number crunching.
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Creating a custom data provider
|
|
64
|
+
`iplotx` is able to seek new data providers at runtime, but they need to be registered in a specific way (keyword: `entry point`).
|
|
65
|
+
|
|
66
|
+
The expected entry point for a `NetworkDataProvider` is: `iplotx.network_data_providers`.
|
|
67
|
+
|
|
68
|
+
The expected entry point for a `TreeDataProvider` is: `iplotx.tree_data_providers`.
|
|
69
|
+
|
|
70
|
+
```{note}
|
|
71
|
+
If you would like to make a library compatible with `iplotx` (by developing a provider), we are here to help! Just reach out on GitHub issues and we will try to help.
|
|
72
|
+
```
|