用toyplot绘制最小树
toytree的Python项目详细描述
使用toytree绘制树
欢迎来到Toytree,这是一个用于Jupyter笔记本电脑内部的极简树操作和绘图库。toytree结合了一种流行的基于ete3库的树数据结构和基于toyplot库的现代绘图工具。toytree的目标是提供一个轻量级的python,相当于r中常用的树操作和绘图库,并以此促进python中系统发生方法的进一步发展。toytree生成丰富的交互式图形(svg+html+js),可以嵌入到jupyter笔记本或网页中,也可以用svg、pdf或png呈现出版物。
安装
您可以使用conda(首选)或从pip使用单个命令安装toytree及其依赖项(toyplot和numpy)。
conda install toytree -c eaton-lab
文档
请参见full documentation以查看toytree提供的所有选项。使用toytree binder在云中立即试用。
示例
# import toyplot and load a newick file from a public URLimporttoytreetre=toytree.tree("https://eaton-lab.org/data/Cyathophora.tre")# root the tree using a wildcard string matching and draw a tree figure.rtre=tre.root(wildcard='prz')rtre.draw(width=400,tip_labels_align=True);# or chain a few functions togethertre.root(wildcard='prz').drop_tips(wildcard="tham").ladderize().draw();# extensive styling options are availablertre.draw(tip_labels_color='pink',node_labels='support',node_sizes=15,node_colors="cyan",edge_style={"stroke":"darkgrey","stroke-width":3,},)