Search code examples
pythonpython-3.xoverlapdiagram

How to prevent labels from overlapping arrows in diagrams' Edge() - class


While using the diagrams as code Python library, how can I prevent text from overlapping arrows as seen in the screenshot?

overlapping-arrows

from diagrams import Cluster, Diagram, Edge
...

with Diagram("Clustered Web Services",
             show=False,
             graph_attr={
                 'pad': '0.1',
                 'bgcolor': 'transparent'
             }) as diag:

    ...
    
    with Cluster("AWS"):
        with Cluster("Pipeline"):
            ....

        with Cluster("S3 Storage"):
            ...
    # PLOT
    ...
    lambda_main >> Edge(label="Storing filtered & prioritized suggestions",
                        style="bold",
                        color="black") >> s3_bucket_full
    ...

Solution

  • I found that in many cases, using xlabel instead of just label within Edge(..) helps resolving the issue.