Entering edit mode
2.1 years ago
Begonia_pavonina
▴
200
I am trying to familiarize with Biopython for phylogenetics with the official documentation.
Using the code below, I have plotted a phylogenetic tree.
from io import StringIO
from Bio import Phylo
from Bio.Phylo.Applications import PhymlCommandline
from Bio.Phylo.PAML import codeml
from Bio.Phylo.PhyloXML import Phylogeny
%matplotlib inline
# Load IQtree tree file data:
tree = Phylo.read('example.phy.treefile', "newick")
# Input the tree name:
tree.name = 'Example phylogenetic tree'
# Draw the tree plot:
fig = plt.figure(figsize=(16, 18), dpi=100)
ax = fig.add_subplot(1, 1, 1)
Phylo.draw(tree, axes=ax)
Unfortunately the confidence levels on the axes are difficult to read, and I wish to change their colour to blue. I have tried the different codes below to change the colour, but none is working. Would anyone know the way to do it?
tree.branch_labels.color="blue"
tree.Clade.confidence.color = 'blue'
tree.Clade.color = 'blue'
Clade.confidence.color = 'blue'
Example file: https://drive.google.com/file/d/1t9kbd2ySn_B2rkgf5aJ-dgUBcCTFJ3PN/view?usp=sharing
Tree plot: https://drive.google.com/file/d/1S774FWaSzIIRU-EPdt2MAJTWIrQEMiOe/view?usp=sharing
You can try
plt.rcParams["text.color"] = 'blue'
.Crosspost: https://stackoverflow.com/q/74069786/3548799