diagrams
diagrams copied to clipboard
How to change the fontsize of all labels
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")
This still does not seem to work. Also, is there a way to set the fontsize for all Cluster
labels?
@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