.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/tree/plot_split_edges.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_tree_plot_split_edges.py: Split edges =========== This example shows how to use split edges, i.e. how to apply different styles to tree edges that are composed of multiple segments. See also :doc:`../zero_dependency/plot_simpletreedataprovider` for the basic example of how to plot a tree with ``iplotx``'s internal tree representation. .. note:: The current implementation only supports two-piece edges. .. GENERATED FROM PYTHON SOURCE LINES 12-47 .. image-sg:: /gallery/tree/images/sphx_glr_plot_split_edges_001.png :alt: plot split edges :srcset: /gallery/tree/images/sphx_glr_plot_split_edges_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none | .. code-block:: Python from collections import defaultdict import matplotlib.pyplot as plt import iplotx as ipx tree = { "children": ( {}, { "children": ( { "children": ( {}, {} ) }, { "children": ( {}, {} ) } ) } ) } tree = ipx.ingest.providers.tree.simple.SimpleTree.from_dict(tree) ipx.tree( tree, style="tree", edge_split_linestyle=":", edge_split_color=defaultdict(lambda: "k", {tree.children[1]: "red"}), ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.031 seconds) .. _sphx_glr_download_gallery_tree_plot_split_edges.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_split_edges.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_split_edges.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_split_edges.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_