iplotx 0.5.1__tar.gz → 0.6.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.
- {iplotx-0.5.1 → iplotx-0.6.1}/PKG-INFO +1 -1
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/api/complete_style_specification.md +23 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/sg_execution_times.rst +27 -3
- iplotx-0.6.1/gallery/plot_arrowlawn.py +81 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_arrows.py +5 -2
- iplotx-0.6.1/gallery/plot_edgepadding.py +37 -0
- iplotx-0.6.1/gallery/plot_elements.py +43 -0
- iplotx-0.6.1/gallery/plot_feedbacks.py +54 -0
- iplotx-0.6.1/gallery/plot_redblack.py +71 -0
- iplotx-0.6.1/gallery/plot_waypoints.py +40 -0
- iplotx-0.6.1/gallery/tree/plot_elements_tree.py +55 -0
- iplotx-0.6.1/gallery/tree/plot_style_tree.py +42 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/edge/__init__.py +20 -6
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/edge/arrow.py +79 -1
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/edge/geometry.py +91 -42
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/ingest/providers/network/simple.py +4 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/ingest/providers/tree/simple.py +2 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/ingest/typing.py +10 -8
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/label.py +6 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/plotting.py +1 -2
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/style/__init__.py +1 -1
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/style/leaf_info.py +2 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/style/library.py +22 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/tree.py +6 -9
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/utils/matplotlib.py +3 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/version.py +1 -1
- iplotx-0.6.1/tests/baseline_images/test_biopython/directed_child.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_biopython.py +26 -7
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_edge.py +24 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_edge_geometry.py +1 -1
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_geometry.py +56 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_heuristics.py +17 -42
- iplotx-0.6.1/tests/test_ingest_protocols.py +52 -0
- iplotx-0.6.1/tests/test_matplotlib_utils.py +57 -0
- iplotx-0.6.1/tests/test_simple_tree_provider.py +222 -0
- iplotx-0.6.1/tests/test_style.py +109 -0
- iplotx-0.5.1/tests/test_matplotlib_utils.py +0 -18
- iplotx-0.5.1/tests/test_simple_tree_provider.py +0 -92
- iplotx-0.5.1/tests/test_style.py +0 -68
- {iplotx-0.5.1 → iplotx-0.6.1}/.github/workflows/publish.yml +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/.github/workflows/test.yml +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/.gitignore +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/.pre-commit-config.yaml +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/.readthedocs.yaml +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/LICENSE +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/MANIFEST.in +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/README.md +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/assets/pylint.svg +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/Makefile +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/make.bat +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/_static/banner.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/_static/graph_basic.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/_templates/layout.html +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/api/artists.md +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/api/plotting.md +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/api/providers.md +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/api/style.md +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/api.md +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/conf.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/images/sphx_glr_plot_basic_001.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/images/thumb/sphx_glr_plot_basic_thumb.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/index.md +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/providers.md +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/docs/source/style.md +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/GALLERY_HEADER.rst +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/data/chess_masters_WCC.pgn.bz2 +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/data/knuth_miles.txt.gz +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_animation.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_basic.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_big_curves.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_chess_masters.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_cliques.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_cluster_layout.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_company_structure.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_complex.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_dag.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_directed.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_edit_artists.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_four_grids.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_grouping.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_halfarrows.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_house.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_knuth_miles.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_labels_and_colors.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_loops.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_max_bipartite_matching.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_minimum_spanning_trees.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_mouse_hover.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_multipartite_layout.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_multistyle.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_parallel_igraph_networkx.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_ports.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_shortest_path.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_simple_networkx.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_simple_path.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_simplenetworkdataprovider.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_style.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_tension.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_traveling_salesman.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_vertexmarkers.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_voronoi.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/plot_with_colorbar.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/GALLERY_HEADER.rst +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/data/tree-with-support.json +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_angular_waypoints.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_biopython_tree.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_cladeedges.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_cogent3_layouts.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_cogent3_tree.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_ete4.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_leafedges.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_leafedges_and_cascades.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_simpletreedataprovider.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_skbio_tree.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_split_edges.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_support.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_tree_node_background.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_tree_style_clades.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/gallery/tree/plot_trees_of_trees.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/__init__.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/artists.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/cascades.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/edge/leaf.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/edge/ports.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/groups.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/ingest/__init__.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/ingest/heuristics.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/ingest/providers/network/igraph.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/ingest/providers/network/networkx.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/ingest/providers/tree/biopython.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/ingest/providers/tree/cogent3.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/ingest/providers/tree/ete4.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/ingest/providers/tree/skbio.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/layout.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/network.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/typing.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/utils/geometry.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/utils/internal.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/utils/style.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/iplotx/vertex.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/pyproject.toml +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/scripts/copy_github_release_into_version.sh +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/scripts/make_banner.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/scripts/update_pylint_badge.sh +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_biopython/cascades.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_biopython/leaf_labels.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_biopython/leaf_labels_hmargin.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_biopython/leafedges.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_biopython/show_support.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_biopython/tree_basic.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_biopython/tree_radial.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_cogent3/leaf_labels.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_cogent3/leaf_labels_hmargin.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_cogent3/tree_basic.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_cogent3/tree_radial.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_ete4/leaf_labels.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_ete4/leaf_labels_hmargin.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_ete4/split_edges.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_ete4/tree_basic.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_ete4/tree_radial.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/clustering_directed.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/clustering_directed_large.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/graph_basic.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/graph_directed.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/graph_directed_curved_loops.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/graph_edit_children.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/graph_labels.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/graph_layout_attribute.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/graph_null.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/graph_squares_directed.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/graph_with_curved_edges.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/igraph_layout_object.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_igraph/multigraph_with_curved_edges_undirected.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_networkx/cluster-layout.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_networkx/complex.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_networkx/complex_rotatelabels.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_networkx/directed_graph.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_networkx/directed_graph_with_colorbar.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_networkx/empty_graph.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_networkx/flat_style.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_networkx/house_with_colors.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_networkx/labels_and_colors.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_networkx/shortest_path.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_networkx/simple_graph.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_simple_network_provider/graph_basic.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_simple_network_provider/graph_directed.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_simple_network_provider/graph_labels.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_skbio/leaf_labels.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_skbio/leaf_labels_hmargin.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_skbio/tree_basic.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/baseline_images/test_skbio/tree_radial.png +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_arrows.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_cascades.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_cogent3.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_ete4.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_igraph.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_network_hotload.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_networkx.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_ports.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_simple_network_provider.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_skbio.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/test_vertex.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/tests/utils.py +0 -0
- {iplotx-0.5.1 → iplotx-0.6.1}/uv.lock +0 -0
|
@@ -69,6 +69,13 @@
|
|
|
69
69
|
# unless the "norm" option is used.
|
|
70
70
|
"color": str | float | Any,
|
|
71
71
|
|
|
72
|
+
# How to cap the edge line. Should be "butt" (default), "round", or "projecting".
|
|
73
|
+
"capstyle": str,
|
|
74
|
+
|
|
75
|
+
# Whether to leave any space between edge cap and vertex border. This is
|
|
76
|
+
# in figure points and autoscales correctly with dpi.
|
|
77
|
+
"padding": float,
|
|
78
|
+
|
|
72
79
|
# Matplotlib color map used to map floating numbers into RGBA colors. Only
|
|
73
80
|
# used when the previous option "color" is set to floats.
|
|
74
81
|
"cmap": str | matplotlib.colors.Colormap,
|
|
@@ -138,10 +145,15 @@
|
|
|
138
145
|
# |/
|
|
139
146
|
# |\\ (double slash needed to avoid character escaping)
|
|
140
147
|
# >
|
|
148
|
+
# <
|
|
141
149
|
# >>
|
|
142
150
|
# )>
|
|
143
151
|
# )
|
|
152
|
+
# (
|
|
153
|
+
# ]
|
|
154
|
+
# [
|
|
144
155
|
# |
|
|
156
|
+
# x (or X)
|
|
145
157
|
# s
|
|
146
158
|
# d
|
|
147
159
|
# p
|
|
@@ -180,6 +192,17 @@
|
|
|
180
192
|
"bbox": dict, # Bounding box properties for the label (see vertex labels)
|
|
181
193
|
|
|
182
194
|
},
|
|
195
|
+
|
|
196
|
+
############################################################################
|
|
197
|
+
# The following edge properties are only valid for trees via `iplotx.tree`
|
|
198
|
+
"split": {
|
|
199
|
+
# NOTE: This takes any properties of "edge" except for itself (i.e. no
|
|
200
|
+
# "nested" split) and applies it to the last segment of split edges.
|
|
201
|
+
"color": str | Any, # Color of the split edge
|
|
202
|
+
|
|
203
|
+
# ...
|
|
204
|
+
},
|
|
205
|
+
|
|
183
206
|
},
|
|
184
207
|
|
|
185
208
|
# The following entry is used by networks ONLY (not trees as plotted by `iplotx.tree`)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Computation times
|
|
8
8
|
=================
|
|
9
|
-
**00:
|
|
9
|
+
**00:00.045** total execution time for 59 files **from all galleries**:
|
|
10
10
|
|
|
11
11
|
.. container::
|
|
12
12
|
|
|
@@ -32,12 +32,15 @@ Computation times
|
|
|
32
32
|
* - Example
|
|
33
33
|
- Time
|
|
34
34
|
- Mem (MB)
|
|
35
|
-
* - :ref:`
|
|
36
|
-
- 00:
|
|
35
|
+
* - :ref:`sphx_glr_gallery_plot_feedbacks.py` (``../../gallery/plot_feedbacks.py``)
|
|
36
|
+
- 00:00.045
|
|
37
37
|
- 0.0
|
|
38
38
|
* - :ref:`sphx_glr_gallery_plot_animation.py` (``../../gallery/plot_animation.py``)
|
|
39
39
|
- 00:00.000
|
|
40
40
|
- 0.0
|
|
41
|
+
* - :ref:`sphx_glr_gallery_plot_arrowlawn.py` (``../../gallery/plot_arrowlawn.py``)
|
|
42
|
+
- 00:00.000
|
|
43
|
+
- 0.0
|
|
41
44
|
* - :ref:`sphx_glr_gallery_plot_arrows.py` (``../../gallery/plot_arrows.py``)
|
|
42
45
|
- 00:00.000
|
|
43
46
|
- 0.0
|
|
@@ -68,9 +71,15 @@ Computation times
|
|
|
68
71
|
* - :ref:`sphx_glr_gallery_plot_directed.py` (``../../gallery/plot_directed.py``)
|
|
69
72
|
- 00:00.000
|
|
70
73
|
- 0.0
|
|
74
|
+
* - :ref:`sphx_glr_gallery_plot_edgepadding.py` (``../../gallery/plot_edgepadding.py``)
|
|
75
|
+
- 00:00.000
|
|
76
|
+
- 0.0
|
|
71
77
|
* - :ref:`sphx_glr_gallery_plot_edit_artists.py` (``../../gallery/plot_edit_artists.py``)
|
|
72
78
|
- 00:00.000
|
|
73
79
|
- 0.0
|
|
80
|
+
* - :ref:`sphx_glr_gallery_plot_elements.py` (``../../gallery/plot_elements.py``)
|
|
81
|
+
- 00:00.000
|
|
82
|
+
- 0.0
|
|
74
83
|
* - :ref:`sphx_glr_gallery_plot_four_grids.py` (``../../gallery/plot_four_grids.py``)
|
|
75
84
|
- 00:00.000
|
|
76
85
|
- 0.0
|
|
@@ -113,6 +122,9 @@ Computation times
|
|
|
113
122
|
* - :ref:`sphx_glr_gallery_plot_ports.py` (``../../gallery/plot_ports.py``)
|
|
114
123
|
- 00:00.000
|
|
115
124
|
- 0.0
|
|
125
|
+
* - :ref:`sphx_glr_gallery_plot_redblack.py` (``../../gallery/plot_redblack.py``)
|
|
126
|
+
- 00:00.000
|
|
127
|
+
- 0.0
|
|
116
128
|
* - :ref:`sphx_glr_gallery_plot_shortest_path.py` (``../../gallery/plot_shortest_path.py``)
|
|
117
129
|
- 00:00.000
|
|
118
130
|
- 0.0
|
|
@@ -140,6 +152,9 @@ Computation times
|
|
|
140
152
|
* - :ref:`sphx_glr_gallery_plot_voronoi.py` (``../../gallery/plot_voronoi.py``)
|
|
141
153
|
- 00:00.000
|
|
142
154
|
- 0.0
|
|
155
|
+
* - :ref:`sphx_glr_gallery_plot_waypoints.py` (``../../gallery/plot_waypoints.py``)
|
|
156
|
+
- 00:00.000
|
|
157
|
+
- 0.0
|
|
143
158
|
* - :ref:`sphx_glr_gallery_plot_with_colorbar.py` (``../../gallery/plot_with_colorbar.py``)
|
|
144
159
|
- 00:00.000
|
|
145
160
|
- 0.0
|
|
@@ -158,6 +173,9 @@ Computation times
|
|
|
158
173
|
* - :ref:`sphx_glr_gallery_tree_plot_cogent3_tree.py` (``../../gallery/tree/plot_cogent3_tree.py``)
|
|
159
174
|
- 00:00.000
|
|
160
175
|
- 0.0
|
|
176
|
+
* - :ref:`sphx_glr_gallery_tree_plot_elements_tree.py` (``../../gallery/tree/plot_elements_tree.py``)
|
|
177
|
+
- 00:00.000
|
|
178
|
+
- 0.0
|
|
161
179
|
* - :ref:`sphx_glr_gallery_tree_plot_ete4.py` (``../../gallery/tree/plot_ete4.py``)
|
|
162
180
|
- 00:00.000
|
|
163
181
|
- 0.0
|
|
@@ -173,6 +191,12 @@ Computation times
|
|
|
173
191
|
* - :ref:`sphx_glr_gallery_tree_plot_skbio_tree.py` (``../../gallery/tree/plot_skbio_tree.py``)
|
|
174
192
|
- 00:00.000
|
|
175
193
|
- 0.0
|
|
194
|
+
* - :ref:`sphx_glr_gallery_tree_plot_split_edges.py` (``../../gallery/tree/plot_split_edges.py``)
|
|
195
|
+
- 00:00.000
|
|
196
|
+
- 0.0
|
|
197
|
+
* - :ref:`sphx_glr_gallery_tree_plot_style_tree.py` (``../../gallery/tree/plot_style_tree.py``)
|
|
198
|
+
- 00:00.000
|
|
199
|
+
- 0.0
|
|
176
200
|
* - :ref:`sphx_glr_gallery_tree_plot_support.py` (``../../gallery/tree/plot_support.py``)
|
|
177
201
|
- 00:00.000
|
|
178
202
|
- 0.0
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Arrow lawn
|
|
3
|
+
==========
|
|
4
|
+
|
|
5
|
+
This example demonstrates the visualisation of a network with 1,000 nodes and a few thousand
|
|
6
|
+
edges, using a custom layout that resembles a lawn of arrows.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
import iplotx as ipx
|
|
11
|
+
import matplotlib.pyplot as plt
|
|
12
|
+
|
|
13
|
+
n = 1000 # Number of nodes
|
|
14
|
+
k = 3
|
|
15
|
+
layout = np.random.rand(n, 2)
|
|
16
|
+
nodes = np.arange(n)
|
|
17
|
+
edges = []
|
|
18
|
+
for i, v1 in enumerate(layout):
|
|
19
|
+
found = 0
|
|
20
|
+
dv = layout - v1
|
|
21
|
+
for j in (dv**2).sum(axis=1).argsort()[1:]:
|
|
22
|
+
angle = 180 / np.pi * np.arctan2(dv[j, 1], dv[j, 0])
|
|
23
|
+
# Only make an edge for neighbors towards the north-east
|
|
24
|
+
if 10 < angle < 80:
|
|
25
|
+
edges.append((i, j))
|
|
26
|
+
found += 1
|
|
27
|
+
if found == k:
|
|
28
|
+
break
|
|
29
|
+
|
|
30
|
+
# Plot the network using iplotx
|
|
31
|
+
fig, ax = plt.subplots(figsize=(7, 7))
|
|
32
|
+
ipx.network(
|
|
33
|
+
{'nodes': nodes, 'edges': edges, 'directed': True},
|
|
34
|
+
layout=layout,
|
|
35
|
+
ax=ax,
|
|
36
|
+
vertex_size=5,
|
|
37
|
+
vertex_alpha=0.8,
|
|
38
|
+
vertex_facecolor="seagreen",
|
|
39
|
+
vertex_edgecolor="none",
|
|
40
|
+
edge_arrow_width=3,
|
|
41
|
+
edge_alpha=0.5,
|
|
42
|
+
)
|
|
43
|
+
fig.tight_layout()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# %%
|
|
47
|
+
# If you want to start pushing the scalability of iplotx, you can try with 10,000 nodes and
|
|
48
|
+
# ~30,000 edges. This takes ~14 seconds on a modern laptop, of which 5 are spent on building
|
|
49
|
+
# the network and 9 are spent inside of ``iplotx`` visualising it:
|
|
50
|
+
|
|
51
|
+
n = 10000 # Number of nodes
|
|
52
|
+
k = 3
|
|
53
|
+
layout = np.random.rand(n, 2)
|
|
54
|
+
nodes = np.arange(n)
|
|
55
|
+
edges = []
|
|
56
|
+
for i, v1 in enumerate(layout):
|
|
57
|
+
found = 0
|
|
58
|
+
dv = layout - v1
|
|
59
|
+
for j in (dv**2).sum(axis=1).argsort()[1:]:
|
|
60
|
+
angle = 180 / np.pi * np.arctan2(dv[j, 1], dv[j, 0])
|
|
61
|
+
# Only make an edge for neighbors towards the north-east
|
|
62
|
+
if 10 < angle < 80:
|
|
63
|
+
edges.append((i, j))
|
|
64
|
+
found += 1
|
|
65
|
+
if found == k:
|
|
66
|
+
break
|
|
67
|
+
|
|
68
|
+
# Plot the network using iplotx
|
|
69
|
+
fig, ax = plt.subplots(figsize=(9, 9))
|
|
70
|
+
ipx.network(
|
|
71
|
+
{'nodes': nodes, 'edges': edges, 'directed': True},
|
|
72
|
+
layout=layout,
|
|
73
|
+
ax=ax,
|
|
74
|
+
vertex_size=5,
|
|
75
|
+
vertex_alpha=0.8,
|
|
76
|
+
vertex_facecolor="seagreen",
|
|
77
|
+
vertex_edgecolor="none",
|
|
78
|
+
edge_arrow_width=3,
|
|
79
|
+
edge_alpha=0.5,
|
|
80
|
+
)
|
|
81
|
+
fig.tight_layout()
|
|
@@ -9,14 +9,15 @@ import networkx as nx
|
|
|
9
9
|
import matplotlib.pyplot as plt
|
|
10
10
|
import iplotx as ipx
|
|
11
11
|
|
|
12
|
-
arrow_markers = ["|>", "|/", "|\\", ">", ">>", ")>", ")", "
|
|
12
|
+
arrow_markers = ["|>", "|/", "|\\", ">", "<", ">>", ")>", ")", "(", "]", "[", "|",
|
|
13
|
+
"x", "s", "d", "p", "q"]
|
|
13
14
|
n = len(arrow_markers)
|
|
14
15
|
G = nx.DiGraph()
|
|
15
16
|
G.add_edges_from([(f"l{i}", f"r{i}") for i in range(n)])
|
|
16
17
|
layout = {f"l{i}": (0, -i) for i in range(n)}
|
|
17
18
|
layout.update({f"r{i}": (1, -i) for i in range(n)})
|
|
18
19
|
|
|
19
|
-
fig, ax = plt.subplots(figsize=(3,
|
|
20
|
+
fig, ax = plt.subplots(figsize=(3, 8.5))
|
|
20
21
|
ipx.network(
|
|
21
22
|
G,
|
|
22
23
|
layout=layout,
|
|
@@ -24,8 +25,10 @@ ipx.network(
|
|
|
24
25
|
vertex_size=12,
|
|
25
26
|
edge_arrow_marker=arrow_markers,
|
|
26
27
|
edge_arrow_height="width",
|
|
28
|
+
edge_padding=8,
|
|
27
29
|
edge_color="steelblue",
|
|
28
30
|
title="Arrow markers",
|
|
29
31
|
)
|
|
30
32
|
ax.set_yticks(list(range(-n + 1, 1))[::-1])
|
|
31
33
|
ax.set_yticklabels(arrow_markers)
|
|
34
|
+
ax.yaxis.set_tick_params(length=0)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Edge padding
|
|
3
|
+
============
|
|
4
|
+
|
|
5
|
+
This example illustrates how to pad edges, i.e. leave a bit of empty space between
|
|
6
|
+
edge cap (end) and the border of its source/target vertices.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import iplotx as ipx
|
|
10
|
+
|
|
11
|
+
graph = {
|
|
12
|
+
"edges": [
|
|
13
|
+
("A", "B"),
|
|
14
|
+
("B", "C"),
|
|
15
|
+
("C", "D"),
|
|
16
|
+
("C", "E"),
|
|
17
|
+
("E", "Bingo"),
|
|
18
|
+
],
|
|
19
|
+
"directed": True,
|
|
20
|
+
}
|
|
21
|
+
layout = {
|
|
22
|
+
"A": (0, 0),
|
|
23
|
+
"B": (1, 0),
|
|
24
|
+
"C": (1, 1),
|
|
25
|
+
"D": (-1, 1),
|
|
26
|
+
"E": (-0.5, 2),
|
|
27
|
+
"Bingo": (0, 3),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ipx.network(
|
|
31
|
+
graph,
|
|
32
|
+
layout,
|
|
33
|
+
style="rededge",
|
|
34
|
+
edge_padding=5,
|
|
35
|
+
vertex_labels=True,
|
|
36
|
+
vertex_size={"A": 20, "B": 20, "C": 20, "D": 20, "E": 20, "Bingo": 50},
|
|
37
|
+
)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Network element showroom
|
|
3
|
+
========================
|
|
4
|
+
|
|
5
|
+
This example showcases various plot elements that can be styled in ``iplotx``.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import matplotlib.pyplot as plt
|
|
9
|
+
import iplotx as ipx
|
|
10
|
+
|
|
11
|
+
network = {
|
|
12
|
+
"edges": [(0, 1), (1, 2), (2, 3), (3, 0), (2, 2)],
|
|
13
|
+
"directed": True,
|
|
14
|
+
}
|
|
15
|
+
layout = [(0, 0), (1, 0), (1, 1), (0, 1)]
|
|
16
|
+
|
|
17
|
+
fig, ax = plt.subplots(figsize=(4.3, 4.3))
|
|
18
|
+
ipx.network(
|
|
19
|
+
network,
|
|
20
|
+
layout,
|
|
21
|
+
ax=ax,
|
|
22
|
+
vertex_labels=["Vertex\nlabel"] + [""] * 3,
|
|
23
|
+
edge_labels=["", "", "Edge\nlabel", "", ""],
|
|
24
|
+
vertex_label_bbox_edgecolor="k",
|
|
25
|
+
vertex_label_bbox_linewidth=1.5,
|
|
26
|
+
vertex_label_bbox_facecolor="steelblue",
|
|
27
|
+
vertex_label_bbox_alpha=0.5,
|
|
28
|
+
edge_label_bbox_edgecolor="k",
|
|
29
|
+
edge_label_bbox_linewidth=1.5,
|
|
30
|
+
edge_label_bbox_facecolor="tomato",
|
|
31
|
+
edge_color=["k", "tomato", "k", "k", "k"],
|
|
32
|
+
edge_arrow_color=["k", "darkred", "k", "k", "k"],
|
|
33
|
+
edge_linewidth=[2, 4, 2, 2, 2],
|
|
34
|
+
vertex_facecolor=["w"] * 3 + ["steelblue"],
|
|
35
|
+
vertex_edgecolor="k",
|
|
36
|
+
vertex_linewidth=2,
|
|
37
|
+
vertex_size=[50, 25, 25, 50],
|
|
38
|
+
vertex_marker="o",
|
|
39
|
+
vertex_label_color="k",
|
|
40
|
+
edge_curved=True,
|
|
41
|
+
edge_tension=[0, 1.25, 0, 3.5],
|
|
42
|
+
margins=(0, 0.08),
|
|
43
|
+
)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Feedback loops
|
|
3
|
+
==============
|
|
4
|
+
|
|
5
|
+
Graphs with arrows and bars are commonly used to represent feedback loops in systems.
|
|
6
|
+
This example shows how to obtain that effect in ``iplotx``.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
import matplotlib.pyplot as plt
|
|
11
|
+
import iplotx as ipx
|
|
12
|
+
|
|
13
|
+
graph = {
|
|
14
|
+
"edges": [
|
|
15
|
+
("A", "B"),
|
|
16
|
+
("B", "C"),
|
|
17
|
+
("C", "A"),
|
|
18
|
+
],
|
|
19
|
+
"directed": True,
|
|
20
|
+
}
|
|
21
|
+
layout = {
|
|
22
|
+
"A": (0, 0),
|
|
23
|
+
"B": (1, 0),
|
|
24
|
+
"C": (0.5, 0.5 * 1.73),
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
fig, ax = plt.subplots()
|
|
28
|
+
ipx.network(
|
|
29
|
+
graph,
|
|
30
|
+
layout,
|
|
31
|
+
ax=ax,
|
|
32
|
+
vertex_size=50,
|
|
33
|
+
edge_linewidth=5,
|
|
34
|
+
edge_arrow_width=30,
|
|
35
|
+
edge_arrow_height=40,
|
|
36
|
+
edge_arrow_marker=[")>", "|", "|"],
|
|
37
|
+
edge_padding=15,
|
|
38
|
+
edge_curved=True,
|
|
39
|
+
edge_tension=[2, 2, 2],
|
|
40
|
+
vertex_facecolor=["#26677FFF", "#635C72FF", "#89374FFF"],
|
|
41
|
+
vertex_edgecolor="black",
|
|
42
|
+
vertex_linewidth=5,
|
|
43
|
+
aspect=1.0,
|
|
44
|
+
margins=0.1,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
# Add a parametric spiral
|
|
48
|
+
t = np.linspace(0, 4 * np.pi, 400)
|
|
49
|
+
ax.plot(
|
|
50
|
+
0.5 + np.cos(t + np.pi) * t / 40,
|
|
51
|
+
0.31 + np.sin(t + np.pi) * t / 40,
|
|
52
|
+
color="grey",
|
|
53
|
+
lw=4,
|
|
54
|
+
)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The red and the black
|
|
3
|
+
=====================
|
|
4
|
+
|
|
5
|
+
This example demonstrates how to overlay an ``iplotx`` artist with plain matplotlib patches.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
import iplotx as ipx
|
|
11
|
+
import matplotlib.pyplot as plt
|
|
12
|
+
|
|
13
|
+
# We will use a network laid out onto a square grid
|
|
14
|
+
gsize = 5 # Grid size
|
|
15
|
+
layout = [(i % gsize, i // gsize) for i in range(gsize**2)]
|
|
16
|
+
|
|
17
|
+
# Two possible colors
|
|
18
|
+
colorlist = np.array(["tomato", "#111"])
|
|
19
|
+
|
|
20
|
+
# Assign node colors at random
|
|
21
|
+
node_colors = colorlist[np.random.randint(2, size=gsize**2)]
|
|
22
|
+
|
|
23
|
+
# Connect two neighboring nodes if they have the same color
|
|
24
|
+
edges = []
|
|
25
|
+
for inode in range(gsize**2):
|
|
26
|
+
i = inode // gsize
|
|
27
|
+
j = inode % gsize
|
|
28
|
+
# Four possible edges
|
|
29
|
+
cands = []
|
|
30
|
+
if i != 0:
|
|
31
|
+
cands.append(inode - gsize)
|
|
32
|
+
if j != 0:
|
|
33
|
+
cands.append(inode - 1)
|
|
34
|
+
if i != gsize - 1:
|
|
35
|
+
cands.append(inode + gsize)
|
|
36
|
+
if j != gsize - 1:
|
|
37
|
+
cands.append(inode + 1)
|
|
38
|
+
for inode2 in cands:
|
|
39
|
+
if node_colors[inode] == node_colors[inode2]:
|
|
40
|
+
if (inode2, inode) not in edges:
|
|
41
|
+
edges.append((inode, inode2))
|
|
42
|
+
|
|
43
|
+
# Build the network using our zero-dependency data structure
|
|
44
|
+
network = {
|
|
45
|
+
"edges": edges,
|
|
46
|
+
"nodes": list(range(gsize**2)),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# Visualise the network
|
|
50
|
+
fig, ax = plt.subplots(figsize=(5, 5))
|
|
51
|
+
ipx.network(
|
|
52
|
+
network,
|
|
53
|
+
layout=layout,
|
|
54
|
+
ax=ax,
|
|
55
|
+
vertex_size=8,
|
|
56
|
+
vertex_marker='d',
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Add square patches centered on each node
|
|
60
|
+
for i in range(gsize):
|
|
61
|
+
for j in range(gsize):
|
|
62
|
+
inode = i * gsize + j
|
|
63
|
+
ax.add_patch(plt.Rectangle(
|
|
64
|
+
(j-0.5, i-0.5),
|
|
65
|
+
1,
|
|
66
|
+
1,
|
|
67
|
+
facecolor=node_colors[inode],
|
|
68
|
+
edgecolor="none",
|
|
69
|
+
alpha=0.4,
|
|
70
|
+
zorder=0,
|
|
71
|
+
))
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Edge waypoints
|
|
3
|
+
==============
|
|
4
|
+
|
|
5
|
+
This example demonstrates the use of edge waypoints.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import matplotlib.pyplot as plt
|
|
9
|
+
import numpy as np
|
|
10
|
+
import iplotx as ipx
|
|
11
|
+
|
|
12
|
+
g = {
|
|
13
|
+
"edges": [
|
|
14
|
+
("A", "B"),
|
|
15
|
+
("B", "C"),
|
|
16
|
+
("B", "D"),
|
|
17
|
+
("A", "E"),
|
|
18
|
+
],
|
|
19
|
+
}
|
|
20
|
+
layout = {
|
|
21
|
+
"A": (0, 0),
|
|
22
|
+
"B": (0, 1),
|
|
23
|
+
"C": (1, 2),
|
|
24
|
+
"D": (0, 2),
|
|
25
|
+
"E": (-1, 1),
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
fig, ax = plt.subplots()
|
|
29
|
+
ipx.network(
|
|
30
|
+
g,
|
|
31
|
+
layout=layout,
|
|
32
|
+
ax=ax,
|
|
33
|
+
vertex_labels=True,
|
|
34
|
+
edge_waypoints=["none", [(1, 1), (0.5, 1.5), (1, 1.5)], "none", "none"],
|
|
35
|
+
)
|
|
36
|
+
plt.ion(); plt.show()
|
|
37
|
+
|
|
38
|
+
# %%
|
|
39
|
+
# .. note::
|
|
40
|
+
# Edge waypoints are not currently compatible with curved edges.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tree element showroom
|
|
3
|
+
=====================
|
|
4
|
+
|
|
5
|
+
This example showcases plot elements for tree styling in ``iplotx``.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import matplotlib.pyplot as plt
|
|
9
|
+
import iplotx as ipx
|
|
10
|
+
|
|
11
|
+
tree = {
|
|
12
|
+
"name": "Vertex\nlabel",
|
|
13
|
+
"children": [
|
|
14
|
+
{
|
|
15
|
+
"children": [
|
|
16
|
+
{},
|
|
17
|
+
{
|
|
18
|
+
"children": [{}, {}]
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{},
|
|
23
|
+
],
|
|
24
|
+
}
|
|
25
|
+
tree = ipx.ingest.providers.tree.simple.SimpleTree.from_dict(tree)
|
|
26
|
+
|
|
27
|
+
fig, ax = plt.subplots(figsize=(3.9, 3.3))
|
|
28
|
+
ipx.tree(
|
|
29
|
+
tree,
|
|
30
|
+
ax=ax,
|
|
31
|
+
vertex_size=[0] * 6 + [(45, 35)],
|
|
32
|
+
vertex_marker="r",
|
|
33
|
+
vertex_facecolor=["none"] * 6 + ["orange"],
|
|
34
|
+
vertex_alpha=0.5,
|
|
35
|
+
vertex_edgecolor="black",
|
|
36
|
+
vertex_linewidth=1.5,
|
|
37
|
+
vertex_labels=True,
|
|
38
|
+
vertex_label_hmargin=0,
|
|
39
|
+
leaf_labels={tree.children[0].children[0]: "Leaf\nlabel"},
|
|
40
|
+
leaf_label_bbox_facecolor="lightcoral",
|
|
41
|
+
leaf_label_bbox_edgecolor="black",
|
|
42
|
+
leaf_label_bbox_alpha=0.9,
|
|
43
|
+
leaf_deep=True,
|
|
44
|
+
cascade_facecolor={
|
|
45
|
+
tree.children[0].children[1]: "gold",
|
|
46
|
+
},
|
|
47
|
+
edge_linewidth=3,
|
|
48
|
+
edge_split_linewidth=3,
|
|
49
|
+
edge_split_linestyle=["-."] + ["-"] * 6,
|
|
50
|
+
edge_split_color=["tomato"] + ["black"] * 6,
|
|
51
|
+
edge_capstyle="round",
|
|
52
|
+
edge_split_capstyle="round",
|
|
53
|
+
margins=(0.21, 0.08),
|
|
54
|
+
)
|
|
55
|
+
plt.ion(); plt.show()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Style hierarchy
|
|
3
|
+
===============
|
|
4
|
+
|
|
5
|
+
This example shows a few elements from ``iplotx``'s style hierarchy.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import matplotlib.pyplot as plt
|
|
9
|
+
import iplotx as ipx
|
|
10
|
+
|
|
11
|
+
tree = {
|
|
12
|
+
"name": "style",
|
|
13
|
+
"children": [
|
|
14
|
+
{
|
|
15
|
+
"name": "vertex",
|
|
16
|
+
"children": [
|
|
17
|
+
{
|
|
18
|
+
"name": "size",
|
|
19
|
+
},
|
|
20
|
+
{"name": "..."},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
{"name": "..."},
|
|
24
|
+
],
|
|
25
|
+
}
|
|
26
|
+
tree = ipx.ingest.providers.tree.simple.SimpleTree.from_dict(tree)
|
|
27
|
+
|
|
28
|
+
fig, ax = plt.subplots(figsize=(4, 2.5))
|
|
29
|
+
ipx.tree(
|
|
30
|
+
tree,
|
|
31
|
+
ax=ax,
|
|
32
|
+
vertex_labels=True,
|
|
33
|
+
vertex_size=[(50, 25)] * 5,
|
|
34
|
+
vertex_facecolor="none",
|
|
35
|
+
vertex_edgecolor="black",
|
|
36
|
+
vertex_linewidth=1.5,
|
|
37
|
+
vertex_marker="r",
|
|
38
|
+
vertex_label_horizontalalignment="center",
|
|
39
|
+
vertex_label_hmargin=0,
|
|
40
|
+
margins=(0.1, 0.1),
|
|
41
|
+
)
|
|
42
|
+
ax.invert_yaxis()
|
|
@@ -105,6 +105,10 @@ class EdgeCollection(mpl.collections.PatchCollection):
|
|
|
105
105
|
# NOTE: This should also set the transform
|
|
106
106
|
super().__init__(patches, transform=transform, *args, **kwargs)
|
|
107
107
|
|
|
108
|
+
# Apparenyly capstyle is lost upon collection creation
|
|
109
|
+
if "capstyle" in self._style:
|
|
110
|
+
self.set_capstyle(self._style["capstyle"])
|
|
111
|
+
|
|
108
112
|
# This is important because it prepares the right flags for scalarmappable
|
|
109
113
|
self.set_facecolor("none")
|
|
110
114
|
|
|
@@ -158,6 +162,10 @@ class EdgeCollection(mpl.collections.PatchCollection):
|
|
|
158
162
|
**kwargs,
|
|
159
163
|
)
|
|
160
164
|
|
|
165
|
+
# Apparently capstyle is lost upon collection creation
|
|
166
|
+
if "capstyle" in style:
|
|
167
|
+
self._subedges.set_capstyle(style["capstyle"])
|
|
168
|
+
|
|
161
169
|
def get_children(self) -> tuple:
|
|
162
170
|
children = []
|
|
163
171
|
if hasattr(self, "_subedges"):
|
|
@@ -188,7 +196,7 @@ class EdgeCollection(mpl.collections.PatchCollection):
|
|
|
188
196
|
return self._directed
|
|
189
197
|
|
|
190
198
|
@directed.setter
|
|
191
|
-
def directed(self, value) -> None:
|
|
199
|
+
def directed(self, value: bool) -> None:
|
|
192
200
|
"""Setter for the directed property.
|
|
193
201
|
|
|
194
202
|
Changing this property triggers the addition/removal of arrows from the plot.
|
|
@@ -230,7 +238,11 @@ class EdgeCollection(mpl.collections.PatchCollection):
|
|
|
230
238
|
# NOTE: The superclass also sets stale = True
|
|
231
239
|
super().update_scalarmappable()
|
|
232
240
|
# Now self._edgecolors has the correct colorspace values
|
|
233
|
-
|
|
241
|
+
# NOTE: The following line should include a condition on
|
|
242
|
+
# whether the arrows are allowing color matching to the
|
|
243
|
+
# edges. For now, we assume that if the edges are colormapped
|
|
244
|
+
# we would want the arrows to be as well.
|
|
245
|
+
if hasattr(self, "_arrows") and (self._A is not None):
|
|
234
246
|
self._arrows.set_colors(self.get_edgecolor())
|
|
235
247
|
|
|
236
248
|
def get_labels(self) -> Optional[LabelCollection]:
|
|
@@ -337,6 +349,10 @@ class EdgeCollection(mpl.collections.PatchCollection):
|
|
|
337
349
|
tension = 0
|
|
338
350
|
ports = None
|
|
339
351
|
|
|
352
|
+
# Scale padding by dpi
|
|
353
|
+
dpi = self.figure.dpi if hasattr(self, "figure") else 72.0
|
|
354
|
+
padding = dpi / 72.0 * edge_stylei.pop("padding", 0)
|
|
355
|
+
|
|
340
356
|
# False is a synonym for "none"
|
|
341
357
|
waypoints = edge_stylei.get("waypoints", "none")
|
|
342
358
|
if waypoints is False or waypoints is np.False_:
|
|
@@ -348,9 +364,6 @@ class EdgeCollection(mpl.collections.PatchCollection):
|
|
|
348
364
|
if waypoints != "none":
|
|
349
365
|
ports = edge_stylei.get("ports", (None, None))
|
|
350
366
|
|
|
351
|
-
if not isinstance(waypoints, str):
|
|
352
|
-
__import__("ipdb").set_trace()
|
|
353
|
-
|
|
354
367
|
# Compute actual edge path
|
|
355
368
|
path, angles = _compute_edge_path(
|
|
356
369
|
vcoord_data,
|
|
@@ -362,6 +375,7 @@ class EdgeCollection(mpl.collections.PatchCollection):
|
|
|
362
375
|
waypoints=waypoints,
|
|
363
376
|
ports=ports,
|
|
364
377
|
layout_coordinate_system=self._vertex_collection.get_layout_coordinate_system(),
|
|
378
|
+
padding=padding,
|
|
365
379
|
)
|
|
366
380
|
|
|
367
381
|
offset = edge_stylei.get("offset", 0)
|
|
@@ -375,7 +389,6 @@ class EdgeCollection(mpl.collections.PatchCollection):
|
|
|
375
389
|
offset = offset * vrot
|
|
376
390
|
offset = np.asarray(offset, dtype=float)
|
|
377
391
|
# Scale by dpi
|
|
378
|
-
dpi = self.figure.dpi if hasattr(self, "figure") else 72.0
|
|
379
392
|
offset *= dpi / 72.0
|
|
380
393
|
if (offset != 0).any():
|
|
381
394
|
path.vertices[:] = trans_inv(trans(path.vertices) + offset)
|
|
@@ -702,6 +715,7 @@ def make_stub_patch(**kwargs):
|
|
|
702
715
|
"cmap",
|
|
703
716
|
"norm",
|
|
704
717
|
"split",
|
|
718
|
+
"padding",
|
|
705
719
|
]
|
|
706
720
|
for prop in forbidden_props:
|
|
707
721
|
if prop in kwargs:
|