comparison phylorelatives.py @ 42:35741a74d073 draft default tip

type="cairo" added to plotting function
author boris
date Wed, 29 Jan 2014 11:05:27 -0500
parents dd39849c2ff1
children
comparison
equal deleted inserted replaced
41:9453ba52f46b 42:35741a74d073
100 def ape_plot_tree(outfile, tree1, root=False): 100 def ape_plot_tree(outfile, tree1, root=False):
101 """Plot tree to png file""" 101 """Plot tree to png file"""
102 ape = importr('ape') 102 ape = importr('ape')
103 graphics = importr('graphics') 103 graphics = importr('graphics')
104 grdevices = importr('grDevices') 104 grdevices = importr('grDevices')
105 grdevices.png(file=outfile, width=1024, height=768) 105 grdevices.png(file=outfile, width=1024, height=768,type="cairo")
106 if root: 106 if root:
107 tree = ape.root(tree1,root) 107 tree = ape.root(tree1,root)
108 labels = list(tree.rx("tip.label")[0]) 108 labels = list(tree.rx("tip.label")[0])
109 colors = robjects.StrVector(["red" if tip.endswith("_minor") else "black" for tip in labels]) 109 colors = robjects.StrVector(["red" if tip.endswith("_minor") else "black" for tip in labels])
110 ape.plot_phylo(tree,tip_color=colors,use_edge_length=0, 110 ape.plot_phylo(tree,tip_color=colors,use_edge_length=0,