iplotx 0.1.0__tar.gz → 0.2.1__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.
Files changed (152) hide show
  1. {iplotx-0.1.0 → iplotx-0.2.1}/.github/workflows/test.yml +2 -2
  2. {iplotx-0.1.0 → iplotx-0.2.1}/.gitignore +5 -1
  3. iplotx-0.2.1/.readthedocs.yaml +25 -0
  4. iplotx-0.2.1/PKG-INFO +88 -0
  5. iplotx-0.2.1/README.md +50 -0
  6. iplotx-0.2.1/assets/pylint.svg +23 -0
  7. iplotx-0.2.1/docs/Makefile +20 -0
  8. iplotx-0.2.1/docs/make.bat +35 -0
  9. iplotx-0.2.1/docs/source/_static/graph_basic.png +0 -0
  10. iplotx-0.2.1/docs/source/_templates/layout.html +9 -0
  11. iplotx-0.2.1/docs/source/api.md +60 -0
  12. iplotx-0.2.1/docs/source/conf.py +141 -0
  13. iplotx-0.2.1/docs/source/images/sphx_glr_plot_basic_001.png +0 -0
  14. iplotx-0.2.1/docs/source/images/thumb/sphx_glr_plot_basic_thumb.png +0 -0
  15. iplotx-0.2.1/docs/source/index.md +118 -0
  16. iplotx-0.2.1/docs/source/sg_execution_times.rst +130 -0
  17. iplotx-0.2.1/docs/source/style.md +185 -0
  18. iplotx-0.2.1/gallery/GALLERY_HEADER.rst +3 -0
  19. iplotx-0.2.1/gallery/chess_masters_WCC.pgn.bz2 +0 -0
  20. iplotx-0.2.1/gallery/knuth_miles.txt.gz +0 -0
  21. iplotx-0.2.1/gallery/plot_animation.py +61 -0
  22. iplotx-0.2.1/gallery/plot_basic.py +15 -0
  23. iplotx-0.2.1/gallery/plot_big_curves.py +24 -0
  24. iplotx-0.2.1/gallery/plot_biopython_tree.py +60 -0
  25. iplotx-0.2.1/gallery/plot_chess_masters.py +150 -0
  26. iplotx-0.2.1/gallery/plot_cliques.py +83 -0
  27. iplotx-0.2.1/gallery/plot_cluster_layout.py +70 -0
  28. iplotx-0.2.1/gallery/plot_cogent3_tree.py +55 -0
  29. iplotx-0.2.1/gallery/plot_complex.py +51 -0
  30. iplotx-0.2.1/gallery/plot_dag.py +37 -0
  31. iplotx-0.2.1/gallery/plot_directed.py +15 -0
  32. iplotx-0.2.1/gallery/plot_edit_artists.py +59 -0
  33. iplotx-0.2.1/gallery/plot_ete4.py +39 -0
  34. iplotx-0.2.1/gallery/plot_four_grids.py +87 -0
  35. iplotx-0.2.1/gallery/plot_grouping.py +92 -0
  36. iplotx-0.2.1/gallery/plot_house.py +44 -0
  37. iplotx-0.2.1/gallery/plot_knuth_miles.py +130 -0
  38. iplotx-0.2.1/gallery/plot_labels_and_colors.py +76 -0
  39. iplotx-0.2.1/gallery/plot_loops.py +105 -0
  40. iplotx-0.2.1/gallery/plot_max_bipartite_matching.py +78 -0
  41. iplotx-0.2.1/gallery/plot_minimum_spanning_trees.py +75 -0
  42. iplotx-0.2.1/gallery/plot_multipartite_layout.py +51 -0
  43. iplotx-0.2.1/gallery/plot_parallel_igraph_networkx.py +23 -0
  44. iplotx-0.2.1/gallery/plot_ports.py +69 -0
  45. iplotx-0.2.1/gallery/plot_shortest_path.py +57 -0
  46. iplotx-0.2.1/gallery/plot_simple_networkx.py +46 -0
  47. iplotx-0.2.1/gallery/plot_simple_path.py +32 -0
  48. iplotx-0.2.1/gallery/plot_skbio_tree.py +39 -0
  49. iplotx-0.2.1/gallery/plot_style.py +29 -0
  50. iplotx-0.2.1/gallery/plot_traveling_salesman.py +74 -0
  51. iplotx-0.2.1/gallery/plot_voronoi.py +63 -0
  52. iplotx-0.2.1/gallery/plot_with_colorbar.py +119 -0
  53. iplotx-0.2.1/iplotx/__init__.py +23 -0
  54. iplotx-0.2.1/iplotx/edge/__init__.py +623 -0
  55. iplotx-0.2.1/iplotx/edge/arrow.py +332 -0
  56. iplotx-0.2.1/iplotx/edge/geometry.py +392 -0
  57. iplotx-0.2.1/iplotx/edge/ports.py +47 -0
  58. iplotx-0.2.1/iplotx/groups.py +189 -0
  59. iplotx-0.2.1/iplotx/ingest/__init__.py +155 -0
  60. iplotx-0.2.1/iplotx/ingest/heuristics.py +209 -0
  61. iplotx-0.2.1/iplotx/ingest/providers/network/igraph.py +96 -0
  62. iplotx-0.2.1/iplotx/ingest/providers/network/networkx.py +133 -0
  63. iplotx-0.2.1/iplotx/ingest/providers/tree/biopython.py +105 -0
  64. iplotx-0.2.1/iplotx/ingest/providers/tree/cogent3.py +112 -0
  65. iplotx-0.2.1/iplotx/ingest/providers/tree/ete4.py +112 -0
  66. iplotx-0.2.1/iplotx/ingest/providers/tree/skbio.py +112 -0
  67. iplotx-0.2.1/iplotx/ingest/typing.py +100 -0
  68. iplotx-0.2.1/iplotx/label.py +162 -0
  69. iplotx-0.2.1/iplotx/layout.py +139 -0
  70. iplotx-0.2.1/iplotx/network.py +289 -0
  71. iplotx-0.2.1/iplotx/plotting.py +206 -0
  72. iplotx-0.2.1/iplotx/style.py +391 -0
  73. iplotx-0.2.1/iplotx/tree.py +312 -0
  74. iplotx-0.2.1/iplotx/typing.py +55 -0
  75. {iplotx-0.1.0 → iplotx-0.2.1}/iplotx/utils/geometry.py +128 -81
  76. iplotx-0.2.1/iplotx/utils/internal.py +3 -0
  77. {iplotx-0.1.0 → iplotx-0.2.1}/iplotx/utils/matplotlib.py +58 -38
  78. iplotx-0.2.1/iplotx/utils/style.py +1 -0
  79. iplotx-0.2.1/iplotx/version.py +5 -0
  80. iplotx-0.2.1/iplotx/vertex.py +362 -0
  81. {iplotx-0.1.0 → iplotx-0.2.1}/pyproject.toml +35 -5
  82. iplotx-0.2.1/scripts/update_pylint_badge.sh +12 -0
  83. iplotx-0.2.1/tests/baseline_images/test_biopython/leaf_labels.png +0 -0
  84. iplotx-0.2.1/tests/baseline_images/test_biopython/leaf_labels_hmargin.png +0 -0
  85. iplotx-0.2.1/tests/baseline_images/test_biopython/tree_basic.png +0 -0
  86. iplotx-0.2.1/tests/baseline_images/test_biopython/tree_radial.png +0 -0
  87. iplotx-0.2.1/tests/baseline_images/test_cogent3/leaf_labels.png +0 -0
  88. iplotx-0.2.1/tests/baseline_images/test_cogent3/leaf_labels_hmargin.png +0 -0
  89. iplotx-0.2.1/tests/baseline_images/test_cogent3/tree_basic.png +0 -0
  90. iplotx-0.2.1/tests/baseline_images/test_cogent3/tree_radial.png +0 -0
  91. iplotx-0.2.1/tests/baseline_images/test_ete4/leaf_labels.png +0 -0
  92. iplotx-0.2.1/tests/baseline_images/test_ete4/leaf_labels_hmargin.png +0 -0
  93. iplotx-0.2.1/tests/baseline_images/test_ete4/tree_basic.png +0 -0
  94. iplotx-0.2.1/tests/baseline_images/test_ete4/tree_radial.png +0 -0
  95. iplotx-0.2.1/tests/baseline_images/test_igraph/clustering_directed.png +0 -0
  96. iplotx-0.2.1/tests/baseline_images/test_igraph/clustering_directed_large.png +0 -0
  97. iplotx-0.2.1/tests/baseline_images/test_igraph/graph_basic.png +0 -0
  98. iplotx-0.2.1/tests/baseline_images/test_igraph/graph_directed.png +0 -0
  99. iplotx-0.2.1/tests/baseline_images/test_igraph/graph_directed_curved_loops.png +0 -0
  100. iplotx-0.2.1/tests/baseline_images/test_igraph/graph_edit_children.png +0 -0
  101. iplotx-0.2.1/tests/baseline_images/test_igraph/graph_labels.png +0 -0
  102. iplotx-0.2.1/tests/baseline_images/test_igraph/graph_layout_attribute.png +0 -0
  103. iplotx-0.2.1/tests/baseline_images/test_igraph/graph_null.png +0 -0
  104. iplotx-0.2.1/tests/baseline_images/test_igraph/graph_squares_directed.png +0 -0
  105. iplotx-0.2.1/tests/baseline_images/test_igraph/igraph_layout_object.png +0 -0
  106. iplotx-0.2.1/tests/baseline_images/test_igraph/multigraph_with_curved_edges_undirected.png +0 -0
  107. iplotx-0.2.1/tests/baseline_images/test_networkx/cluster-layout.png +0 -0
  108. iplotx-0.2.1/tests/baseline_images/test_networkx/complex.png +0 -0
  109. iplotx-0.2.1/tests/baseline_images/test_networkx/directed_graph.png +0 -0
  110. iplotx-0.2.1/tests/baseline_images/test_networkx/directed_graph_with_colorbar.png +0 -0
  111. iplotx-0.2.1/tests/baseline_images/test_networkx/empty_graph.png +0 -0
  112. iplotx-0.2.1/tests/baseline_images/test_networkx/flat_style.png +0 -0
  113. iplotx-0.2.1/tests/baseline_images/test_networkx/house_with_colors.png +0 -0
  114. iplotx-0.2.1/tests/baseline_images/test_networkx/labels_and_colors.png +0 -0
  115. iplotx-0.2.1/tests/baseline_images/test_networkx/shortest_path.png +0 -0
  116. iplotx-0.2.1/tests/baseline_images/test_networkx/simple_graph.png +0 -0
  117. iplotx-0.2.1/tests/baseline_images/test_skbio/leaf_labels.png +0 -0
  118. iplotx-0.2.1/tests/baseline_images/test_skbio/leaf_labels_hmargin.png +0 -0
  119. iplotx-0.2.1/tests/baseline_images/test_skbio/tree_basic.png +0 -0
  120. iplotx-0.2.1/tests/baseline_images/test_skbio/tree_radial.png +0 -0
  121. iplotx-0.2.1/tests/test_biopython.py +85 -0
  122. iplotx-0.2.1/tests/test_cogent3.py +81 -0
  123. iplotx-0.2.1/tests/test_ete4.py +81 -0
  124. iplotx-0.2.1/tests/test_igraph.py +323 -0
  125. iplotx-0.2.1/tests/test_networkx.py +409 -0
  126. iplotx-0.2.1/tests/test_skbio.py +83 -0
  127. iplotx-0.2.1/tests/test_style.py +60 -0
  128. {iplotx-0.1.0 → iplotx-0.2.1}/tests/utils.py +2 -0
  129. {iplotx-0.1.0 → iplotx-0.2.1}/uv.lock +718 -231
  130. iplotx-0.1.0/PKG-INFO +0 -47
  131. iplotx-0.1.0/README.md +0 -18
  132. iplotx-0.1.0/iplotx/__init__.py +0 -2
  133. iplotx-0.1.0/iplotx/edge/arrow.py +0 -122
  134. iplotx-0.1.0/iplotx/edge/common.py +0 -47
  135. iplotx-0.1.0/iplotx/edge/directed.py +0 -149
  136. iplotx-0.1.0/iplotx/edge/label.py +0 -50
  137. iplotx-0.1.0/iplotx/edge/undirected.py +0 -447
  138. iplotx-0.1.0/iplotx/groups.py +0 -141
  139. iplotx-0.1.0/iplotx/heuristics.py +0 -114
  140. iplotx-0.1.0/iplotx/importing.py +0 -13
  141. iplotx-0.1.0/iplotx/network.py +0 -507
  142. iplotx-0.1.0/iplotx/plotting.py +0 -105
  143. iplotx-0.1.0/iplotx/styles.py +0 -186
  144. iplotx-0.1.0/iplotx/typing.py +0 -41
  145. iplotx-0.1.0/iplotx/version.py +0 -1
  146. iplotx-0.1.0/iplotx/vertex.py +0 -112
  147. iplotx-0.1.0/tests/baseline_images/test_igraph/graph_basic.png +0 -0
  148. iplotx-0.1.0/tests/baseline_images/test_igraph/graph_directed.png +0 -0
  149. iplotx-0.1.0/tests/test_igraph.py +0 -291
  150. {iplotx-0.1.0 → iplotx-0.2.1}/.github/workflows/publish.yml +0 -0
  151. {iplotx-0.1.0 → iplotx-0.2.1}/LICENSE +0 -0
  152. {iplotx-0.1.0 → iplotx-0.2.1}/MANIFEST.in +0 -0
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- python-version: ["3.10", "3.11", "3.12", "3.13"]
19
+ python-version: ["3.11", "3.12", "3.13"]
20
20
 
21
21
  steps:
22
22
  - uses: actions/checkout@v4
@@ -38,4 +38,4 @@ jobs:
38
38
  run: uv run pytest tests
39
39
 
40
40
  - name: Run flake8
41
- run: uv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
41
+ run: uv run flake8 iplotx --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
@@ -1,3 +1,6 @@
1
+ # Tokens
2
+ pypi-token
3
+
1
4
  # Test images
2
5
  result_images
3
6
 
@@ -72,7 +75,8 @@ instance/
72
75
  .scrapy
73
76
 
74
77
  # Sphinx documentation
75
- docs/_build/
78
+ docs/build/
79
+ docs/source/gallery
76
80
 
77
81
  # PyBuilder
78
82
  .pybuilder/
@@ -0,0 +1,25 @@
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ # Required
5
+ version: 2
6
+
7
+ # Build documentation in the "docs/" directory with Sphinx
8
+ sphinx:
9
+ configuration: docs/source/conf.py
10
+
11
+ # Set the OS, Python version, and other tools you might need
12
+ build:
13
+ os: ubuntu-24.04
14
+ tools:
15
+ python: "3.13"
16
+
17
+ jobs:
18
+ pre_create_environment:
19
+ - asdf plugin add uv
20
+ - asdf install uv latest
21
+ - asdf global uv latest
22
+ create_environment:
23
+ - uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
24
+ install:
25
+ - UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs
iplotx-0.2.1/PKG-INFO ADDED
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.4
2
+ Name: iplotx
3
+ Version: 0.2.1
4
+ Summary: Plot networkx from igraph and networkx.
5
+ Project-URL: Homepage, https://github.com/fabilab/iplotx
6
+ Project-URL: Documentation, https://readthedocs.org/iplotx
7
+ Project-URL: Repository, https://github.com/fabilab/iplotx.git
8
+ Project-URL: Bug Tracker, https://github.com/fabilab/iplotx/issues
9
+ Project-URL: Changelog, https://github.com/fabilab/iplotx/blob/main/CHANGELOG.md
10
+ Author-email: Fabio Zanini <fabio.zanini@unsw.edu.au>
11
+ Maintainer-email: Fabio Zanini <fabio.zanini@unsw.edu.au>
12
+ License: MIT
13
+ Keywords: graph,network,plotting,visualisation
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Education
17
+ Classifier: Intended Audience :: Science/Research
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Natural Language :: English
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Scientific/Engineering :: Visualization
26
+ Classifier: Topic :: System :: Networking
27
+ Classifier: Typing :: Typed
28
+ Requires-Python: >=3.11
29
+ Requires-Dist: matplotlib>=2.0.0
30
+ Requires-Dist: numpy>=2.0.0
31
+ Requires-Dist: pandas>=2.0.0
32
+ Requires-Dist: pylint>=3.3.7
33
+ Provides-Extra: igraph
34
+ Requires-Dist: igraph>=0.11.0; extra == 'igraph'
35
+ Provides-Extra: networkx
36
+ Requires-Dist: networkx>=2.0.0; extra == 'networkx'
37
+ Description-Content-Type: text/markdown
38
+
39
+ ![Github Actions](https://github.com/fabilab/iplotx/actions/workflows/test.yml/badge.svg)
40
+ ![PyPI - Version](https://img.shields.io/pypi/v/iplotx)
41
+ ![RTD](https://readthedocs.org/projects/iplotx/badge/?version=latest)
42
+ ![pylint](assets/pylint.svg)
43
+
44
+ # iplotx
45
+ Plotting networks from igraph and networkx.
46
+
47
+ **NOTE**: This is currently beta quality software. The API and functionality are settling in and might break occasionally.
48
+
49
+ ## Installation
50
+ ```bash
51
+ pip install iplotx
52
+ ```
53
+
54
+ ## Quick Start
55
+ ```python
56
+ import networkx as nx
57
+ import matplotlib.pyplot as plt
58
+ import iplotx as ipx
59
+
60
+ g = nx.Graph([(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)])
61
+ layout = nx.layout.circular_layout(g)
62
+ fig, ax = plt.subplots(figsize=(3, 3))
63
+ ipx.plot(g, ax=ax, layout=layout)
64
+ ```
65
+
66
+ ![Quick start image](docs/source/_static/graph_basic.png)
67
+
68
+ ## Documentation
69
+ See [readthedocs](https://iplotx.readthedocs.io/en/latest/) for the full documentation.
70
+
71
+ ## Gallery
72
+ See [gallery](https://iplotx.readthedocs.io/en/latest/gallery/index.html).
73
+
74
+ ## Roadmap
75
+ - Plot networks from igraph and networkx interchangeably, using matplotlib as a backend. ✅
76
+ - Support interactive plotting, e.g. zooming and panning after the plot is created. ✅
77
+ - Support storing the plot to disk thanks to the many matplotlib backends (SVG, PNG, PDF, etc.). ✅
78
+ - Support flexible yet easy styling. ✅
79
+ - Efficient plotting of large graphs using matplotlib's collection functionality. ✅
80
+ - Support editing plotting elements after the plot is created, e.g. changing node colors, labels, etc. ✅
81
+ - Support animations, e.g. showing the evolution of a network over time. ✅
82
+ - Support trees from special libraries such as ete3, biopython, etc. This will need a dedicated function and layouting. ✅
83
+ - Support uni- and bi-directional communication between graph object and plot object.🏗️
84
+
85
+ **NOTE:** The last item can probably be achieved already by using `matplotlib`'s existing callback functionality. It is currently untested, but if you manage to get it to work on your graph let me know and I'll add it to the examples (with credit).
86
+
87
+ ## Authors
88
+ Fabio Zanini (https://fabilab.org)
iplotx-0.2.1/README.md ADDED
@@ -0,0 +1,50 @@
1
+ ![Github Actions](https://github.com/fabilab/iplotx/actions/workflows/test.yml/badge.svg)
2
+ ![PyPI - Version](https://img.shields.io/pypi/v/iplotx)
3
+ ![RTD](https://readthedocs.org/projects/iplotx/badge/?version=latest)
4
+ ![pylint](assets/pylint.svg)
5
+
6
+ # iplotx
7
+ Plotting networks from igraph and networkx.
8
+
9
+ **NOTE**: This is currently beta quality software. The API and functionality are settling in and might break occasionally.
10
+
11
+ ## Installation
12
+ ```bash
13
+ pip install iplotx
14
+ ```
15
+
16
+ ## Quick Start
17
+ ```python
18
+ import networkx as nx
19
+ import matplotlib.pyplot as plt
20
+ import iplotx as ipx
21
+
22
+ g = nx.Graph([(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)])
23
+ layout = nx.layout.circular_layout(g)
24
+ fig, ax = plt.subplots(figsize=(3, 3))
25
+ ipx.plot(g, ax=ax, layout=layout)
26
+ ```
27
+
28
+ ![Quick start image](docs/source/_static/graph_basic.png)
29
+
30
+ ## Documentation
31
+ See [readthedocs](https://iplotx.readthedocs.io/en/latest/) for the full documentation.
32
+
33
+ ## Gallery
34
+ See [gallery](https://iplotx.readthedocs.io/en/latest/gallery/index.html).
35
+
36
+ ## Roadmap
37
+ - Plot networks from igraph and networkx interchangeably, using matplotlib as a backend. ✅
38
+ - Support interactive plotting, e.g. zooming and panning after the plot is created. ✅
39
+ - Support storing the plot to disk thanks to the many matplotlib backends (SVG, PNG, PDF, etc.). ✅
40
+ - Support flexible yet easy styling. ✅
41
+ - Efficient plotting of large graphs using matplotlib's collection functionality. ✅
42
+ - Support editing plotting elements after the plot is created, e.g. changing node colors, labels, etc. ✅
43
+ - Support animations, e.g. showing the evolution of a network over time. ✅
44
+ - Support trees from special libraries such as ete3, biopython, etc. This will need a dedicated function and layouting. ✅
45
+ - Support uni- and bi-directional communication between graph object and plot object.🏗️
46
+
47
+ **NOTE:** The last item can probably be achieved already by using `matplotlib`'s existing callback functionality. It is currently untested, but if you manage to get it to work on your graph let me know and I'll add it to the examples (with credit).
48
+
49
+ ## Authors
50
+ Fabio Zanini (https://fabilab.org)
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="20">
3
+ <linearGradient id="b" x2="0" y2="100%">
4
+ <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
5
+ <stop offset="1" stop-opacity=".1"/>
6
+ </linearGradient>
7
+ <mask id="anybadge_1">
8
+ <rect width="80" height="20" rx="3" fill="#fff"/>
9
+ </mask>
10
+ <g mask="url(#anybadge_1)">
11
+ <path fill="#555" d="M0 0h44v20H0z"/>
12
+ <path fill="#4C1" d="M44 0h36v20H44z"/>
13
+ <path fill="url(#b)" d="M0 0h80v20H0z"/>
14
+ </g>
15
+ <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
16
+ <text x="23.0" y="15" fill="#010101" fill-opacity=".3">pylint</text>
17
+ <text x="22.0" y="14">pylint</text>
18
+ </g>
19
+ <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
20
+ <text x="63.0" y="15" fill="#010101" fill-opacity=".3">9.13</text>
21
+ <text x="62.0" y="14">9.13</text>
22
+ </g>
23
+ </svg>
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = source
9
+ BUILDDIR = build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,35 @@
1
+ @ECHO OFF
2
+
3
+ pushd %~dp0
4
+
5
+ REM Command file for Sphinx documentation
6
+
7
+ if "%SPHINXBUILD%" == "" (
8
+ set SPHINXBUILD=sphinx-build
9
+ )
10
+ set SOURCEDIR=source
11
+ set BUILDDIR=build
12
+
13
+ %SPHINXBUILD% >NUL 2>NUL
14
+ if errorlevel 9009 (
15
+ echo.
16
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17
+ echo.installed, then set the SPHINXBUILD environment variable to point
18
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
19
+ echo.may add the Sphinx directory to PATH.
20
+ echo.
21
+ echo.If you don't have Sphinx installed, grab it from
22
+ echo.https://www.sphinx-doc.org/
23
+ exit /b 1
24
+ )
25
+
26
+ if "%1" == "" goto help
27
+
28
+ %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29
+ goto end
30
+
31
+ :help
32
+ %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33
+
34
+ :end
35
+ popd
@@ -0,0 +1,9 @@
1
+ {% extends '!layout.html' %}
2
+ {% block extrahead %}
3
+ {{super()}}
4
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css" />
5
+ {% endblock %}
6
+ {% block document %}
7
+ {{super()}}
8
+ <a class="github-fork-ribbon" href="https://github.com/fabilab/iplotx" data-ribbon="Fork me on GitHub" title="Fork me on GitHub">Fork me on GitHub</a>
9
+ {% endblock %}
@@ -0,0 +1,60 @@
1
+ # Reference API
2
+ This is the reference documentation for `iplotx`.
3
+
4
+ ## Main functions
5
+ The main user-facing function is `iplotx.network`, which can be used to plot graphs and graph groupings (covers and clusterings), and `iplotx.tree` to plot trees. `iplotx.plot` is a synonym for `iplotx.network`.
6
+
7
+ ```{eval-rst}
8
+ .. autofunction:: iplotx.network
9
+ :noindex:
10
+
11
+ .. autofunction:: iplotx.tree
12
+ :noindex:
13
+ ```
14
+
15
+ ## Styling
16
+ See also the <project:style.md> for an introduction to styles in `iplotx`.
17
+
18
+
19
+ ```{eval-rst}
20
+ .. autofunction:: iplotx.style.context
21
+
22
+ .. autofunction:: iplotx.style.use
23
+
24
+ .. autofunction:: iplotx.style.reset
25
+
26
+ .. autofunction:: iplotx.style.get_style
27
+ ```
28
+
29
+ The following functions are reported for completeness but are rarely used by users directly:
30
+
31
+ ```{eval-rst}
32
+ .. autofunction:: iplotx.style.unflatten_style
33
+
34
+ .. autofunction:: iplotx.style.rotate_style
35
+ ```
36
+
37
+ ## Artist hierarchy
38
+ `iplotx.plot` return a list of `matplotlib` artists (1 or 2). When a network is plotted, the first artist is an instance of `iplotx.NetworkArtist`. This class contains the visual elements representing vertices, edges, labels, arrows, etc. and can be used to further edit the plot after `iplotx.plot` returned.
39
+
40
+ A `NetworkArtist` instance has two notable properties: vertices and edges, which are instances of `VertexCollection` and `EdgeCollection`, respectively. These collections are `matplotlib` artists that can be used to modify the appearance of vertices and edges after the plot has been created.
41
+
42
+ In turn, a `VertexCollection` or `EdgeCollection` instance **may** contain a `LabelCollection` instance if the plot includes labels. Moreover, an `EdgeCollection` instance **may** contain an `EdgeArrowCollection` instance if the graph is directed.
43
+
44
+ ```{eval-rst}
45
+ .. autoclass:: iplotx.network.NetworkArtist
46
+ :members:
47
+
48
+
49
+ .. autoclass:: iplotx.vertex.VertexCollection
50
+ :members:
51
+
52
+ .. autoclass:: iplotx.edge.EdgeCollection
53
+ :members:
54
+
55
+ .. autoclass:: iplotx.label.LabelCollection
56
+ :members:
57
+
58
+ .. autoclass:: iplotx.edge.arrow.EdgeArrowCollection
59
+ :members:
60
+ ```
@@ -0,0 +1,141 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # For the full list of built-in configuration values, see the documentation:
4
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
+ import sys
6
+ import os
7
+ from pathlib import Path
8
+ from packaging.version import parse as parse_version
9
+
10
+ import iplotx
11
+
12
+ # -- Project information -----------------------------------------------------
13
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
14
+
15
+ project = "iplotx"
16
+ copyright = "2025-%Y, Fabio Zanini"
17
+ author = "Fabio Zanini"
18
+ release = iplotx.__version__
19
+
20
+ # -- General configuration ---------------------------------------------------
21
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
22
+
23
+ extensions = [
24
+ "sphinx.ext.autodoc",
25
+ "sphinx.ext.napoleon",
26
+ "myst_parser",
27
+ "sphinx_design",
28
+ "sphinx_gallery.gen_gallery",
29
+ ]
30
+
31
+ # Napoleon settings
32
+ napoleon_google_docstring = True
33
+ napoleon_numpy_docstring = False
34
+ napoleon_include_init_with_doc = False
35
+ napoleon_include_private_with_doc = False
36
+ napoleon_include_special_with_doc = True
37
+ napoleon_use_admonition_for_examples = False
38
+ napoleon_use_admonition_for_notes = False
39
+ napoleon_use_admonition_for_references = False
40
+ napoleon_use_ivar = False
41
+ napoleon_use_param = True
42
+ napoleon_use_rtype = True
43
+ napoleon_preprocess_types = False
44
+ napoleon_type_aliases = None
45
+ napoleon_attr_annotations = True
46
+
47
+ myst_enable_extensions = ["colon_fence"]
48
+
49
+ sphinx_gallery_conf = {
50
+ "examples_dirs": "../../gallery", # path to your example scripts
51
+ "gallery_dirs": "./gallery", # path to where to save gallery generated output
52
+ #'matplotlib_animations': (True, 'mp4'),
53
+ "matplotlib_animations": True,
54
+ }
55
+
56
+ source_suffix = {
57
+ ".rst": "restructuredtext",
58
+ ".md": "markdown",
59
+ ".myst": "markdown",
60
+ ".txt": "markdown",
61
+ }
62
+
63
+
64
+ templates_path = ["_templates"]
65
+ exclude_patterns = []
66
+
67
+
68
+ # -- Options for HTML output -------------------------------------------------
69
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
70
+
71
+ html_theme = "sphinx_rtd_theme"
72
+ html_static_path = ["_static"]
73
+
74
+ # -----------------------------------------------------------------------------
75
+ # Source code links (credit to the matplotlib project for this part)
76
+ # -----------------------------------------------------------------------------
77
+ link_github = True
78
+ # You can add build old with link_github = False
79
+
80
+ if link_github:
81
+ import inspect
82
+
83
+ extensions.append("sphinx.ext.linkcode")
84
+
85
+ def linkcode_resolve(domain, info):
86
+ """
87
+ Determine the URL corresponding to Python object
88
+ """
89
+ if domain != "py":
90
+ return None
91
+
92
+ modname = info["module"]
93
+ fullname = info["fullname"]
94
+
95
+ submod = sys.modules.get(modname)
96
+ if submod is None:
97
+ return None
98
+
99
+ obj = submod
100
+ for part in fullname.split("."):
101
+ try:
102
+ obj = getattr(obj, part)
103
+ except AttributeError:
104
+ return None
105
+
106
+ if inspect.isfunction(obj):
107
+ obj = inspect.unwrap(obj)
108
+ try:
109
+ fn = inspect.getsourcefile(obj)
110
+ except TypeError:
111
+ fn = None
112
+ if not fn or fn.endswith("__init__.py"):
113
+ try:
114
+ fn = inspect.getsourcefile(sys.modules[obj.__module__])
115
+ except (TypeError, AttributeError, KeyError):
116
+ fn = None
117
+ if not fn:
118
+ return None
119
+
120
+ try:
121
+ source, lineno = inspect.getsourcelines(obj)
122
+ except (OSError, TypeError):
123
+ lineno = None
124
+
125
+ linespec = f"#L{lineno:d}-L{lineno + len(source) - 1:d}" if lineno else ""
126
+
127
+ startdir = Path(iplotx.__file__).parent.parent
128
+ try:
129
+ fn = os.path.relpath(fn, start=startdir).replace(os.path.sep, "/")
130
+ except ValueError:
131
+ return None
132
+
133
+ if not fn.startswith("iplotx/"):
134
+ return None
135
+
136
+ version = parse_version(iplotx.__version__)
137
+ tag = "main" if version.is_devrelease else f"v{version.public}"
138
+ return "https://github.com/fabilab/iplotx/blob" f"/{tag}/{fn}{linespec}"
139
+
140
+ else:
141
+ extensions.append("sphinx.ext.viewcode")
@@ -0,0 +1,118 @@
1
+ # iplotx documentation
2
+
3
+ `iplotx` is a Python library to display graphs, networks and trees using `matplotlib` as a backend. It supports multiple network analysis libraries including `networkx` and `igraph` for networks and `biopython`, `scikit-bio`, `cogent3`, and `ete4` for trees.
4
+
5
+ `iplotx` guarantees the **exact same visual appearance** independently of what library you used to construct the network/tree.
6
+
7
+ ## Installation
8
+ ```
9
+ pip install iplotx
10
+ ```
11
+
12
+
13
+ ## Quick Start
14
+ ::::{tab-set}
15
+
16
+ :::{tab-item} igraph
17
+
18
+ ```
19
+ import igraph as ig
20
+ import matplotlib.pyplot as plt
21
+ import iplotx as ipx
22
+
23
+ g = ig.Graph.Ring(5)
24
+ layout = g.layout("circle").coords
25
+ fig, ax = plt.subplots(figsize=(3, 3))
26
+ ipx.plot(g, ax=ax, layout=layout)
27
+ ```
28
+
29
+
30
+
31
+ :::
32
+
33
+ :::{tab-item} networkx
34
+ ```
35
+ import networkx as nx
36
+ import matplotlib.pyplot as plt
37
+ import iplotx as ipx
38
+
39
+ g = nx.Graph([(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)])
40
+ layout = nx.layout.circular_layout(g)
41
+ fig, ax = plt.subplots(figsize=(3, 3))
42
+ ipx.plot(g, ax=ax, layout=layout)
43
+ ```
44
+
45
+ :::
46
+
47
+ ::::
48
+
49
+ Either way, the result is the same:
50
+
51
+ ![graph_basic](_static/graph_basic.png)
52
+
53
+ ## Gallery
54
+ See <project:gallery/index.rst> for examples of plots made with `iplotx`. Feel free to suggest new examples on GitHub by opening a new issue or pull request!
55
+
56
+ ## Features
57
+ ```{important}
58
+ If you are the maintainer of a network/graph/tree analysis library and would like
59
+ to propose improvements or see support for it, please reach out with an issue/PR
60
+ on GitHub!
61
+ ```
62
+
63
+ `iplotx`'s features' include:
64
+ - per-edge and per-vertex styling using sequences or dictionaries
65
+ - labels
66
+ - arrows
67
+ - tunable offset for parallel (i.e. multi-) edges
68
+ - ports (a la Graphviz)
69
+ - curved edges and self-loops with controllable tension
70
+ - tree layouts
71
+ - label-based vertex autoscaling
72
+ - node label margins and padding
73
+ - export to many formats (e.g. PNG, SVG, PDF, EPS) thanks to `matplotlib`
74
+ - compatibility with many GUI frameworks (e.g. Qt, GTK, Tkinter) thanks to `matplotlib`
75
+ - data-driven axes autoscaling
76
+ - consistent behaviour upon zooming and panning
77
+ - correct HiDPI scaling (e.g. retina screens)
78
+ - a consistent `matplotlib` artist hierarchy
79
+ - post-plot editability (e.g. for animations)
80
+ - plays well with other charting tools (e.g. `seaborn`)
81
+ - chainable style contexts
82
+ - vertex clusterings and covers with convex hulls and rounding
83
+ - a plugin mechanism for additional libraries (WIP)
84
+ - ... and probably more by the time you read this.
85
+
86
+ ## Styles
87
+ `iplotx` is designed to produce publication-quality figures using **styles**, which are dictionaries specifying the visual properties of each graph element, including vertices, edges, arrows, labels, and groupings.
88
+
89
+ An example of style specification is as follows:
90
+
91
+ ```python
92
+ import iplotx as ipx
93
+ with ipx.style.context({
94
+ 'vertex': {
95
+ 'size': 30,
96
+ 'facecolor': 'red',
97
+ 'edgecolor': 'none',
98
+ }
99
+ }):
100
+ ipx.plot(...)
101
+ ```
102
+
103
+ See <project:style.md> for more info.
104
+
105
+ ## Reference API
106
+ See <project:api.md> for reference documentation of all functions and classes in `iplotx`.
107
+
108
+ ## Rationale
109
+ We believe graph **analysis**, graph **layouting**, and graph **visualisation** to be three separate tasks. `iplotx` currently focuses on visualisation. It can also compute simple tree layouts and might expand towards network layouts in the future.
110
+
111
+ ```{toctree}
112
+ :maxdepth: 2
113
+ :caption: Contents
114
+
115
+ gallery/index
116
+ style
117
+ API <api>
118
+ ```