Python graphviz node positioning

With this code:

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()

I can create the following output:

enter image description here

But I need the "Serial" field under the "Tests" field. How to do it?

+4
source share
1 answer

This can be done using an invisible edge:

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

enter image description here

+4
source

Source: https://habr.com/ru/post/1671990/


All Articles