https://github.com/xflr6/graphviz
Raw File
Tip revision: 405516b9f177a0d4d4832ff57f710c8908e9e786 authored by Sebastian Bank on 13 May 2024, 18:28:50 UTC
refactor `test_deprecate_positional_args()`
Tip revision: 405516b
rank_same.py
#!/usr/bin/env python3

"""https://stackoverflow.com/questions/25734244/how-do-i-place-nodes-on-the-same-level-in-dot"""

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()
back to top