.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/tree/plot_ete4.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_ete4.py: ETE4 tree ========= This example shows how to use `iplotx` to plot trees from `ete4`. .. GENERATED FROM PYTHON SOURCE LINES 7-22 .. code-block:: Python from ete4 import Tree import iplotx as ipx tree = Tree( "((),((),(((),()),((),()))));", ) ipx.plotting.tree( tree, aspect=1, edge_color="grey", edge_linestyle=["--", "-"], ) .. image-sg:: /gallery/tree/images/sphx_glr_plot_ete4_001.png :alt: plot ete4 :srcset: /gallery/tree/images/sphx_glr_plot_ete4_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 23-26 `iplotx` can compute a radial tree layout as well, and usual style modifications work for trees same as networks. Moreover, trees have a layout style option to choose the starting angle and angular span of the radial layout. .. GENERATED FROM PYTHON SOURCE LINES 26-58 .. code-block:: Python # sphinx_gallery_thumbnail_number = 2 ipx.plotting.tree( tree, layout="radial", layout_orientation="right", style=[ "tree", { "edge": { "color": "deeppink", "linewidth": 4, }, "layout": { "start": -180, "span": 180, }, "leaf": { "label": { "hmargin": 15, } }, "leafedge": { "color": "purple", "linewidth": 2, }, }, ], leaf_labels={leaf: str(i + 1) for i, leaf in enumerate(tree.leaves())}, aspect=1, margin=0.1, ) .. image-sg:: /gallery/tree/images/sphx_glr_plot_ete4_002.png :alt: plot ete4 :srcset: /gallery/tree/images/sphx_glr_plot_ete4_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.076 seconds) .. _sphx_glr_download_gallery_tree_plot_ete4.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ete4.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ete4.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_ete4.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_