本文整理汇总了Python中pygraphviz.AGraph.node_attr['style']方法的典型用法代码示例。如果您正苦于以下问题:Python AGraph.node_attr['style']方法的具体用法?Python AGraph.node_attr['style']怎么用?Python AGraph.node_attr['style']使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygraphviz.AGraph
的用法示例。
在下文中一共展示了AGraph.node_attr['style']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Copyright
# 需要导入模块: from pygraphviz import AGraph [as 别名]
# 或者: from pygraphviz.AGraph import node_attr['style'] [as 别名]
"""
# Copyright (C) 2006 by
# Aric Hagberg <[email protected]>
# Dan Schult <[email protected]>
# Manos Renieris, http://www.cs.brown.edu/~er/
# Distributed with BSD license.
# All rights reserved, see LICENSE for details.
__author__ = """Aric Hagberg ([email protected])"""
from pygraphviz import AGraph
A = AGraph()
# set some default node attributes
A.node_attr['style'] = 'filled'
A.node_attr['shape'] = 'circle'
A.node_attr['fixedsize'] = 'true'
A.node_attr['fontcolor'] = '#FFFFFF'
# make a star in shades of red
for i in range( 16 ):
A.add_edge( 0, i )
n = A.get_node( i )
n.attr['fillcolor'] = "#%2x0000" % ( i * 16 )
n.attr['height'] = "%s" % ( i / 16.0 + 0.5 )
n.attr['width'] = "%s" % ( i / 16.0 + 0.5 )
print A.string() # print to screen
A.write( "star.dot" ) # write to simple.dot
print "Wrote star.dot"