How can I reduce the top and bottom margins of these Graphviz nodes? I am specifying "0.05, 0.0 as the margins to each node, with fontsize = 8.
digraph { rankdir = LR
node [shape=box margin=0 width=0 height=0]
asdf [label="asdf\nasdf"]
qwer [label="qwerqwer"]
asdf -> qwer
}
Nodes have a default minimum size (width and height), so if you reduce margins beyond a certain point, it has no effect. At least, this is how it works with box (rectangular) nodes and some of the other simple shapes.
width
and height
actually specify the minimum width and height, not the actual width and height (unless you also specify that sizes are fixed). So to get smaller margins, you can just use very small width
and height
values, and the shapes will still be stretched to fit the labels.
With defaults:
digraph {
node [shape=box]
a -> "longer name"
"longer name" -> "taller\nname"
}
Smaller:
digraph {
node [shape=box,width=0.1,height=0.1]
a -> "longer name"
"longer name" -> "taller\nname"
}
You can also set the margin itself if you want it smaller:
digraph {
node [shape=box,width=0.1,height=0.1,margin=0.01]
a -> "longer name"
"longer name" -> "taller\nname"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With