I'm trying to make a horizontal cluster containing two nodes (here visualized as users) in Python module diagrams which uses Graphviz for rendering.
But the only way to achieve this is by adding edges between the nodes.
from diagrams import Cluster, Diagram
from diagrams.onprem.client import User
with Diagram("sample", show=False) as diag:
with Cluster("sample horizontal cluster with edge"):
node1 = User("Some Node")
node2 = User("Some other Node")
node1 >> node2
Which produces:
I've tried without the connection node1 >> node2
:
with Cluster("sample horizontal cluster with edge", direction="LR"):
node1 = User("Some Node")
node2 = User("Some other Node")
Then it renders vertically, which I don't want:
I don't want to see that edge but have the nodes arranged horizontally.
How can I achieve that?
See this example from Edges guide and connect with an invisible edge using style="invis"
like supported by GraphViz's style
atrribute:
from diagrams import Cluster, Diagram, Edge
from diagrams.onprem.client import User
with Diagram("invisible_edge", show=False) as diag:
with Cluster("sample horizontal cluster with invisible edge"):
node1 = User("Some Node")
node2 = User("Some other Node")
node1 - Edge(style='invis') - node2
Renders using GraphViz to: