.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/tree/plot_leafedges_and_cascades.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_leafedges_and_cascades.py: Leaf edges and cascades ======================= This short example demonstrates how to combine leaf edges and cascades. .. GENERATED FROM PYTHON SOURCE LINES 7-37 .. image-sg:: /gallery/tree/images/sphx_glr_plot_leafedges_and_cascades_001.png :alt: plot leafedges and cascades :srcset: /gallery/tree/images/sphx_glr_plot_leafedges_and_cascades_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none | .. code-block:: Python from Bio import Phylo from io import StringIO import iplotx as ipx # Make a tree from a string in Newick format tree = next( Phylo.NewickIO.parse( StringIO( "(()(()((()())(()()))))", ) ) ) backgrounds = { tree.get_nonterminals()[3]: "turquoise", tree.get_terminals()[0]: "tomato", tree.get_terminals()[1]: "purple", } ipx.plotting.tree( tree, cascade_facecolor=backgrounds, cascade_extend=True, leaf_labels={leaf: f"L{i + 1}" for i, leaf in enumerate(tree.get_terminals())}, edge_color="#111", leafedge_linewidth=2, leafedge_color="steelblue", leafedge_linestyle=":", ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.045 seconds) .. _sphx_glr_download_gallery_tree_plot_leafedges_and_cascades.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_leafedges_and_cascades.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_leafedges_and_cascades.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_leafedges_and_cascades.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_