当前位置: 首页>>代码示例>>Python>>正文


Python TreeStyle.show_border方法代码示例

本文整理汇总了Python中ete2.TreeStyle.show_border方法的典型用法代码示例。如果您正苦于以下问题:Python TreeStyle.show_border方法的具体用法?Python TreeStyle.show_border怎么用?Python TreeStyle.show_border使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ete2.TreeStyle的用法示例。


在下文中一共展示了TreeStyle.show_border方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: plotTree

# 需要导入模块: from ete2 import TreeStyle [as 别名]
# 或者: from ete2.TreeStyle import show_border [as 别名]
 def plotTree(self, tree, out_fn=None, rotation=270, show_leaf_name=False, 
               show_branch_length=False, circularTree=False, show_division_nodes=True, 
               distance_between_branches=4, show_border=False, width=None, height=None):            
     from ete2 import TreeStyle        
     from PyQt4 import QtSvg, QtCore, QtGui
     from ete2.treeview import qt4_render, drawer, main
     
       
     ts = TreeStyle()   
     ts.show_scale = False
     ts.show_border = show_border
     ts.orientation = 1 # 0, tree is drawn from left-to-right. 1, tree is drawn from right-to-left
     ts.rotation = rotation
     ts.show_leaf_name = show_leaf_name
     ts.show_branch_length = show_branch_length
     if circularTree:
         ts.mode = 'c'
     else:
         ts.mode = 'r'
     ts.branch_vertical_margin = distance_between_branches
     
     
     def hideInternalNodesLayout(node):
         if not node.is_leaf():
             node.img_style["size"] = 0
     
     if show_division_nodes is False:
         ts.layout_fn = hideInternalNodesLayout
     
     if out_fn is not None:        
         scene  = qt4_render._TreeScene()
         img = ts
         
         tree_item, n2i, n2f = qt4_render.render(tree, img)
         scene.init_data(tree, img, n2i, n2f)
         tree_item.setParentItem(scene.master_item)
         scene.master_item.setPos(0,0)
         scene.addItem(scene.master_item)      
         main.save(scene, out_fn, w=width, h=height, dpi=600)    
           
     else:
         scene, img = drawer.init_scene(tree, None, ts)
         tree_item, n2i, n2f = qt4_render.render(tree, img)
         scene.init_data(tree, img, n2i, n2f)
     
         tree_item.setParentItem(scene.master_item)
         scene.addItem(scene.master_item)
     
         size = tree_item.rect()
         w, h = size.width(), size.height()
     
         svg = QtSvg.QSvgGenerator()
         svg.setFileName("test.svg")
         svg.setSize(QtCore.QSize(w, h))
         svg.setViewBox(size)
         pp = QtGui.QPainter()
         pp.begin(svg)            
         scene.render(pp, tree_item.rect(), tree_item.rect(), QtCore.Qt.KeepAspectRatio)
开发者ID:kkiefer,项目名称:ilastik,代码行数:60,代码来源:trackingUtilities.py

示例2: get_tree_style

# 需要导入模块: from ete2 import TreeStyle [as 别名]
# 或者: from ete2.TreeStyle import show_border [as 别名]
def get_tree_style(scale=None, vertical_margin=None):

    """Setups the tree-style used when rendering the tree"""

    style = TreeStyle()
    style.show_leaf_name = False

    if scale:
        style.scale = scale

    style.show_border = True

    if vertical_margin:
        style.branch_vertical_margin = vertical_margin

    return style
开发者ID:Jakob37,项目名称:RASP,代码行数:18,代码来源:run_ete.py

示例3: random_color

# 需要导入模块: from ete2 import TreeStyle [as 别名]
# 或者: from ete2.TreeStyle import show_border [as 别名]
    #node.img_style["bgcolor"] = random_color()

#Tree().show()
ts = TreeStyle()
ts.mode = "c"
ts.layout_fn = layout 
ts.show_leaf_name = False
ts.arc_span = 340
ts.arc_start = -70
#ts.allow_face_overlap = True
#ts.show_branch_length = True
ts.draw_guiding_lines = False
ts.optimal_scale_level = "mid"
ts.extra_branch_line_color = "red"
ts.root_opening_factor = 0.50
ts.show_border = True
ts.scale = None
t = Tree()
t.populate(200, random_branches=True, branch_range=(0, 0))
t.dist = 0.0
dists = [n.dist for n in t.traverse() if n.dist != 0]
#print max(dists), min(dists)
t.write(outfile="test.nw")
#for s in [5, None]:
#    ts.scale = s
#    t.render("img_scale_%s.png" %s, tree_style = ts, w=600)
t.show(tree_style=ts)


    
        
开发者ID:a1an77,项目名称:ete,代码行数:29,代码来源:test_circ_scale.py


注:本文中的ete2.TreeStyle.show_border方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。