xflr6 / graphviz

Simple Python interface for Graphviz
https://graphviz.readthedocs.io
MIT License
1.63k stars 211 forks source link

How to use splines=ortho #133

Closed VallesMarinerisExplorer closed 3 years ago

VallesMarinerisExplorer commented 3 years ago

Hi Graphviz,

I was looking on the graphviz website and it is possible to render orthogonal lines busing graphviz. I am wondering if this is a capability for this python version? I want to have the output look something like this: https://stackoverflow.com/questions/8939973/how-can-i-generate-rectangle-style-edges-instead-of-curves-in-graphviz

Thanks!

Alex

xflr6 commented 3 years ago

Hi Alex.

render orthogonal lines busing graphviz

See https://graphviz.readthedocs.io/en/stable/manual.html#styling

In [1]: import graphviz
   ...: 
   ...: d = graphviz.Digraph(name='Orthogonal',
   ...:                      graph_attr={'label': 'Orthogonal edges',
   ...:                                  'splines': 'ortho',
   ...:                                  'nodesep': '0.8'},
   ...:                      node_attr={'shape': 'box'})
   ...: 
   ...: d.edges(['ab', 'ac'])
   ...: d.edges(['bd', 'be'])
   ...: d.edges(['cf', 'cg'])
   ...: 
   ...: d
Out[1]: 

spam