.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/tree/plot_equalangle.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_equalangle.py: Equal angle layout ================== This example showcases the "equal angle" layout. This layout is inspired by the `ggtree `_ layout with the same name, which originally comes from Joseph Felsenstein's book "Inferring Phylogenies". .. GENERATED FROM PYTHON SOURCE LINES 7-26 .. code-block:: Python from cogent3.phylo import nj import numpy as np import iplotx as ipx import matplotlib.pyplot as plt nleaves = 14 distance_dict = {} for i in range(nleaves): for j in range(i): distance_dict[(str(i), str(j))] = np.random.rand() tree = nj.nj(distance_dict) ipx.plotting.tree( tree, layout="equalangle", ) .. image-sg:: /gallery/tree/images/sphx_glr_plot_equalangle_001.png :alt: plot equalangle :srcset: /gallery/tree/images/sphx_glr_plot_equalangle_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 27-31 The "equal daylight" layout is an adjustment of the equal angle layout that attempts to spread out leaves more evenly for imbalanced trees. ``iplotx`` has an experimental implementation of this layout. .. warning:: "Experimental" means you can use it but the API and resulting layout may change in future releases. .. GENERATED FROM PYTHON SOURCE LINES 31-36 .. code-block:: Python ipx.plotting.tree( tree, layout="daylight", ) .. image-sg:: /gallery/tree/images/sphx_glr_plot_equalangle_002.png :alt: plot equalangle :srcset: /gallery/tree/images/sphx_glr_plot_equalangle_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.080 seconds) .. _sphx_glr_download_gallery_tree_plot_equalangle.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_equalangle.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_equalangle.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_equalangle.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_