Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to add a ring around connectors? #544

Closed
jcrsantiago opened this issue Jun 15, 2021 · 2 comments
Closed

Is there a way to add a ring around connectors? #544

jcrsantiago opened this issue Jun 15, 2021 · 2 comments

Comments

@jcrsantiago
Copy link

jcrsantiago commented Jun 15, 2021

I need a way to add a ring around the connectors. Here is an example. Ideally, I can also put a note in or around the circle.

image

@jcrsantiago jcrsantiago changed the title Is there a way to add a ring around edges? Is there a way to add a ring around connectors? Jun 15, 2021
@clayms
Copy link

clayms commented Jun 21, 2021

For simple cases, you can use headclip and tailclip to make the Edges appear to go through a "ring" node in the middle. For more complex cases like your example, you will have to use the neato layout engine and specify the position of each Node.

simple case:

from diagrams import Diagram, Node, Edge

graph_attr = {
    "splines":"ortho",
}


with Diagram("\n\nedge rings", graph_attr=graph_attr, show=False) as diag:
    n1 = Node("n1")
    n2 = Node("n2")
    en1 = Node("VPC\n\n\n\n55", labelloc="c", shape="oval", height="2", width=".5")
    
    n1 - Edge(label="E1/7", minlen="2", headclip="False") - en1 - Edge(label="E1/7", minlen="2", tailclip="False") - n2
    n1 - Edge(label="E1/8", minlen="2", headclip="False") - en1 - Edge(label="E1/8", minlen="2", tailclip="False") - n2

image

To make your more complex example, see the following examples using the neato layout engine.

#290 (comment)

#243 (comment)

#111 (comment)

@jcrsantiago
Copy link
Author

Oh wow I had googled everywhere and couldn't find this. I hope that they add more examples in the docs, it would be very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants