indeed the docs are a bit confusing on the underscores
I'm trying to draw trees using teh Biopython Phylo module.
The trees are OK, but the fonts are huge. How can I make them smaller? I tried something like this but its not working:
tree = Phylo.read(seqtreefile, "newick")
tree.rooted = True
tree = tree.as_phyloxml()
Phylo.draw_graphviz(tree, fontsize='6')
pylab.savefig(os.path.join(outpath,'%s.sequences.png'%model))
(Edited to mark the Python example as code)
4 answers
Try this:
from Bio import Phylo
help(Phylo.draw_graphviz)
In particular this bit
... options to try are: ...font_size, font_color, font_weight, font_family* ...
[Edited to stop BioStars turning underscores into italics]
i.e. Try font_size instead of fontsize in your example.
The options are a little different for Phylo.draw_graphviz (unrooted tree, meaningless branch lengths) and Phylo.draw (rooted tree, meaningful branch lengths.)
Most of the graphical options in Phylo.draw_graphviz are passed along to networkx.draw.
Phylo.draw uses matplotlib directly, so you can tweak graphical options with the dictionary pyplot.rcParams (try playing with it in ipython), e.g.
>>> from matplotlib import pyplot
>>> pyplot.rcParams['fontsize'] = 'xsmall'
Log in to answer this question.