Note
Go to the end to download the full example code.
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”.
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",
)

<iplotx.tree.TreeArtist object at 0x7dd1a600dbd0>
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.
ipx.plotting.tree(
tree,
layout="daylight",
)

<iplotx.tree.TreeArtist object at 0x7dd1a60451d0>
Total running time of the script: (0 minutes 0.080 seconds)