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

How to change the fontsize of all labels #601

Open
seanw2020 opened this issue Oct 4, 2021 · 2 comments
Open

How to change the fontsize of all labels #601

seanw2020 opened this issue Oct 4, 2021 · 2 comments

Comments

@seanw2020
Copy link

seanw2020 commented Oct 4, 2021

First, thanks for this software!

Second, how can we change the fontsize of all labels in a diagram? Changing the "fontsize": "40", value to "10" or "20" below makes no difference, BUT doing Edge(label="howdy", fontsize="40") works. I'd rather not do the latter on every label though...

from diagrams import Diagram, Edge
from diagrams.aws.compute import EC2
from diagrams.aws.database import RDS
from diagrams.aws.network import ELB

ea = {
    "fontsize": "40",
}
with Diagram("foo", show=False, direction="TB", edge_attr=ea):
    ELB("lb") >> Edge(label="howdy") >> [EC2("worker1"),
                  EC2("worker2"),
                  EC2("worker3"),
                  EC2("worker4"),
                  EC2("worker5")] >> RDS("events")
@anders-elastisys
Copy link

This still does not seem to work. Also, is there a way to set the fontsize for all Cluster labels?

@streanger
Copy link

@seanw2020 @anders-elastisys
how about that?

from functools import partial

# define your custom objects
Edge = partial(Edge, labelloc="t", fontsize="20")
Custom = partial(Custom, labelloc="b", fontsize="16")

then all your Edge and Custom objects will have the same attribute you specify and you still can override it for the specific item

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

3 participants