gpt4 book ai didi

alignment - 使graphviz节点左对齐

转载 作者:行者123 更新时间:2023-12-04 16:09:13 25 4
gpt4 key购买 nike

我希望第二列(C和E)中的节点左对齐,而不是居中对齐。

digraph left {
graph [rankdir="LR", splines=ortho];
node [shape=record];

l1 [label="A\l|B\l"];
l2 [label="C\l|short\l"];
l3 [label="E\l|long long text\l"];

l1 -> l2;
l1 -> l3;
}

我看过 this question

但是建议的对节点使用恒定宽度的方法不适合我。我想根据相应的标签宽度将它们设置为不同的宽度。

最佳答案

似乎在所有情况下,图中的节点位置都是从其中心计算得出的。在没有其他实现之前,实现“对齐”外观的唯一方法是使用合适的宽度。

digraph left {
graph [rankdir=LR splines=ortho]
node [shape=record]

l1 [label="A\l|B\l"]
l2 [label="C\l|short\l" width=1.3]
l3 [label="E\l|long long text\l"]

l1 -> l2
l1 -> l3
}

结果是:
enter image description here

关于alignment - 使graphviz节点左对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26541591/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com