import graphviz
d = graphviz.Digraph(filename='rank_same.gv')
with d.subgraph() as s:
s.attr(rank='same')
s.node('A')
s.node('X')
d.node('C')
with d.subgraph() as s:
s.attr(rank='same')
s.node('B')
s.node('D')
s.node('Y')
d.edges(['AB', 'AC', 'CD', 'XY'])
d.view()
from graphviz import Digraph
g = Digraph('G', filename='angles.gv')
g.attr(bgcolor='blue')
with g.subgraph(name='cluster_1') as c:
c.attr(fontcolor='white')
c.attr('node', shape='circle', style='filled', fillcolor='white:black',
gradientangle='360', label='n9:360', fontcolor='black')
c.node('n9')
for i, a in zip(range(8, 0, -1), range(360 - 45, -1, -45)):
c.attr('node', gradientangle='%d' % a, label='n%d:%d' % (i, a))
c.node('n%d' % i)
c.attr(label='Linear Angle Variations (white to black gradient)')
with g.subgraph(name='cluster_2') as c:
c.attr(fontcolor='white')
c.attr('node', shape='circle', style='radial', fillcolor='white:black',
gradientangle='360', label='n18:360', fontcolor='black')
c.node('n18')
for i, a in zip(range(17, 9, -1), range(360 - 45, -1, -45)):
c.attr('node', gradientangle='%d' % a, label='n%d:%d' % (i, a))
c.node('n%d' % i)
c.attr(label='Radial Angle Variations (white to black gradient)')
g.edge('n5', 'n14')
g.view()
from graphviz import Digraph, nohtml
g = Digraph('g', filename='btree.gv',
node_attr={'shape': 'record', 'height': '.1'})
g.node('node0', nohtml('<f0> |<f1> G|<f2>'))
g.node('node1', nohtml('<f0> |<f1> E|<f2>'))
g.node('node2', nohtml('<f0> |<f1> B|<f2>'))
g.node('node3', nohtml('<f0> |<f1> F|<f2>'))
g.node('node4', nohtml('<f0> |<f1> R|<f2>'))
g.node('node5', nohtml('<f0> |<f1> H|<f2>'))
g.node('node6', nohtml('<f0> |<f1> Y|<f2>'))
g.node('node7', nohtml('<f0> |<f1> A|<f2>'))
g.node('node8', nohtml('<f0> |<f1> C|<f2>'))
g.edge('node0:f2', 'node4:f1')
g.edge('node0:f0', 'node1:f1')
g.edge('node1:f0', 'node2:f1')
g.edge('node1:f2', 'node3:f1')
g.edge('node2:f2', 'node8:f1')
g.edge('node2:f0', 'node7:f1')
g.edge('node4:f2', 'node6:f1')
g.edge('node4:f0', 'node5:f1')
g.view()
本文分享自 图像处理与模式识别研究所 微信公众号,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体同步曝光计划 ,欢迎热爱写作的你一起参与!