Skip to content

Commit b7c81a1

Browse files
committed
增加 Graphviz
1 parent b2024b7 commit b7c81a1

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

libs/python.wiki

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,29 @@ Home:[https://github.com/pygraphviz/pygraphviz]
15991599

16001600
[https://en.wikipedia.org/wiki/Graphviz Graphviz] 是一个功能很强大的关系图【自动】生成工具,具体介绍可以参见俺的博文(在“[https://program-think.blogspot.com/2016/02/opensource-review-graphviz.html 这里]”)
16011601

1602-
这个库如其名所示,提供了 Python 对 Graphviz 的封装。
1602+
这个库如其名所示,提供了 Python 对 Graphviz 的封装(基于 SWIG)。
1603+
1604+
<h4>Graphviz</h4>
1605+
1606+
Home:[https://github.com/xflr6/graphviz]
1607+
1608+
这个库与上一个类似,也提供了 Graphviz 的 Python 的封装。
1609+
1610+
这两个库都在 GitHub 上。(可能是因为出现较晚)这个库的 Star 和 Fork 数都不如上一个,不过俺感觉文档比较全。
1611+
1612+
代码示例——创建一个 DOT 图并加入若干节点和连线
1613+
<source lang="python">
1614+
from graphviz import Digraph
1615+
1616+
dot = Digraph(comment='The Round Table')
1617+
&#35; 添加节点
1618+
dot.node('A', 'King Arthur')
1619+
dot.node('B', 'Sir Bedevere the Wise')
1620+
dot.node('L', 'Sir Lancelot the Brave')
1621+
&#35; 添加连线
1622+
dot.edges(['AB', 'AL'])
1623+
dot.edge('B', 'L', constraint='false')
1624+
</source>
16031625

16041626
== 10.2 图像格式转换 ==
16051627

0 commit comments

Comments
 (0)