gpt4 book ai didi

python - 使用 Python 定位 graphviz 节点

转载 作者:太空狗 更新时间:2023-10-30 02:55:21 26 4
gpt4 key购买 nike

使用这段代码:

from graphviz import Graph, Digraph
g = Digraph('G', filename='process.gv', engine='dot')

g.node('Tests')
g.node('Devices')

# Tests
g.edge('TestName', 'Tests')

# Devices
g.edge('Serial', 'Devices')

g.view()

我可以创建以下输出:

enter image description here

但我需要“测试”字段下方的“序列”字段。如何做到这一点?

最佳答案

可以用不可见的边缘来完成:

g.edge('Tests', 'Serial', style="invis")

enter image description here

关于python - 使用 Python 定位 graphviz 节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42718507/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com