GraphViz - 当主图从上到下时如何使子图从左到右?
我有一个像这样的图形文件:
digraph {
"Step1" -> "Step2" -> "Step3";
subgraph step2detail {
"Step2" -> "note1";
"Step2" -> "note2";
"Step2" -> "note3";
"Step2" -> "note4";
rankdir=TB
}
}
我希望子图 step2detail 挂在“Step2”的右侧。
现在看起来像这样:
我希望 Step1、Step2 和 Step3 都垂直位于彼此下方,并且在 1 列中。
I have a graph file like this:
digraph {
"Step1" -> "Step2" -> "Step3";
subgraph step2detail {
"Step2" -> "note1";
"Step2" -> "note2";
"Step2" -> "note3";
"Step2" -> "note4";
rankdir=TB
}
}
I want the subgraph step2detail to hang off to the right of 'Step2'.
Right now it looks like this:
I want Step1, Step2 and Step3 to all be vertically under each other and in 1 column.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
获取您所描述的图表的技巧是使用两个子图并从一个子图链接到另一个子图。 “细节”中看不见的边缘使音符保持对齐。
结果是:
The trick to get the graph you described is to use two subgraphs and link from one to the other. The invisible edges in "details" are what keep the notes aligned.
The result is:
这很简单 - 只需使用
group
属性即可让 graphviz 更喜欢直接边缘:
Here's as simple as it gets - just use the
group
attribute to have graphviz prefer straightedges:
通过将 Step 节点分组为聚类子图,输出如下:
color=invis
删除原本会在簇周围绘制的边框By grouping the Step nodes into a clustered subgraph, the output is as follows:
color=invis
removes the border that would otherwise be drawn around the clusterrankdir 不能直接在子图中工作,但是如果您添加另一组花括号 - 不管它叫什么 -rankdir 可以工作:
rankdir doesn't work directly in the subgraph, but if you add another set of curly braces - whatever that's called - rankdir works:
使用命令:rankdir=LR;
Use the command: rankdir=LR;