mingrammer / diagrams

:art: Diagram as Code for prototyping cloud system architectures
https://diagrams.mingrammer.com
MIT License
37.54k stars 2.45k forks source link

Space between Node and It's label #196

Open sree-cgit opened 4 years ago

sree-cgit commented 4 years ago

Hi, I am trying to figure out a way to increase the space between node and it's label. I am importing custom image icon with Custom class and that made the label hide under the icon. I tried height but that didn't work. I converted the image to 256 pixes but still has the same issue

So, Is there any way to increase the space between node and label

Screenshot 2020-06-09 at 4 28 15 PM
mingrammer commented 4 years ago

Could you please show me your codes? I'll test it on my machine.

sree-cgit commented 4 years ago

https://gist.github.com/sree-cgit/ab8ebe9bdb869e192e7c58c54ba9ec0c

clayms commented 3 years ago

Try adding a \n to the beginning of your label to put a new line character before your label.

clayms commented 3 years ago

@sree-cgit None of us have access to /Users/csreekanth/Desktop. Please add the images to you gist.

clayms commented 3 years ago

@sree-cgit

Does this help?

from diagrams import Diagram, Cluster
from diagrams.custom import Custom
from diagrams.onprem.database import Druid
from diagrams.onprem.analytics import Hive
from diagrams.gcp.analytics import Bigquery
from diagrams.saas.social import Facebook

graph_attr = {
    "fontsize": "60",
    "compund": "True",
    "splines":"spline",
}
cluster_attr = {
    "fontsize": "40",
}
node_attr = {
    "fontsize": "25",
    "height": "10.6",
}
edge_attr = {
    "minlen": "4.0",
    "penwidth":"3.0",
    "concentrate": "true"
}

with Diagram("Custom Architecture", show=False, 
        graph_attr=graph_attr, edge_attr=edge_attr, node_attr=node_attr) as diag:

    with Cluster("Source", graph_attr=cluster_attr):
        facebook = Facebook("\nExternal")
        aol = Custom("\nAol\nLegacy", "aol.png")

    with Cluster("Storage", graph_attr=cluster_attr):
        druid = Druid("\nDruid")
        hive = Hive("\nHive")
        big_query = Bigquery("\n\nBig\nQuery")

    with Cluster("Visualize", graph_attr=cluster_attr):
        hue = Custom("Hue", "hue.png")
        looker = Custom("MAW\nExplorer", "looker.png")
        marvel = Custom("\nMarvel", "marvel.png")

    [facebook, aol] >> hive >> big_query >> [looker, marvel, hue]
    hive >> druid >> [looker, marvel, hue]

diag

image