问题描述
您好,我想要一个带点语的uml序列图,现在我遇到以下问题,我想让布局如下,其中a,b,c和d的直线在顶部,但直线直接到底部。我该如何实现?
Hi there I want to have a uml sequence diagram with dot language, now I have the following problem I want to have the layout as follows with a, b, c and d in a straight line at top but with the lines going straight to the bottom. How can I achieve that?
a b c d
| | | |
| | | |
也许我可以实现a,b,c和d及其所属边为群集
perhaps can I achieve that the a, b, c and d with its belonging edges are clusters where I set a different rankdir for the clusters?
编辑刚刚找到了一种解决方案,只需在a,b,c和d之间添加不可见边即可解决方案?
EDIT Just found a solution by adding invisible edges between a, b, c and d but any other solutions?
推荐答案
您所描述的似乎是 dot
所做的工作
What you describe seems to be what dot
does by default.
例如,此图:
digraph SO {
a -> a1 -> a2
b -> b1 -> b2
c -> c1 -> c2
d -> d1 -> d2
}
像这样出来:
如果您有更复杂的图形,可以使用以下命令强制节点处于相同的高度 rank =相同
。例如:
If you have a more complex graph you can force nodes to be at the same height using rank=same
. For example:
digraph SO {
{ rank = same
a b c d
}
a -> a1 -> a2
b -> b1 -> b2 -> b3 -> b4
c -> c1
d -> d1 -> d2 -> d3
d2 -> a2
}
像这样出来:
但是,如果您要 a
, b
, c
和 d
具体的顺序,我认为您将必须像建议的那样使用不可见的边缘。 点
指南甚至建议这样做:
However, if you want a
, b
, c
and d
to be in a specific order I think you're going to have to use invisible edges like you suggested. The dot
guide even recommends this:
这篇关于Graphviz从上到下从左到右的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!