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 Zero-dependency trees 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.

plot split edges
<iplotx.tree.TreeArtist object at 0x7dd1a5d674d0>

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"}),
)

Total running time of the script: (0 minutes 0.031 seconds)

Gallery generated by Sphinx-Gallery