def tree_layout(tree_file, ps_node_list): t = EvolTree(tree_file, format=0) style_other = NodeStyle() style_other['size'] = 6 style_ps = NodeStyle() style_ps['fgcolor'] = '#ff0000' style_ps['size'] = 6 for node in t.iter_descendants(): descendant = t.get_descendant_by_node_id(node.node_id) if node.node_id in ps_node_list: descendant.img_style = style_ps else: descendant.img_style = style_other ts = TreeStyle() ts.layout_fn = layout ts.show_branch_support = False ts.show_branch_length = False ts.show_leaf_name = False result_picture = os.path.join(output_dir, 'positive_selection_tree.png') t.render(result_picture, tree_style=ts)