在Graphviz中,如何以不同的方向布置子图?

问题描述 投票:0回答:1

存在全局图表的rankdir,用于设置布局的方向。子图或聚类怎么样?有没有办法在TD布局中有一个子图,在BT中有另一个子图?

如何使用以下(不正确的)代码实现附件图像中的图形?

digraph G {
  subgraph cluster0 {
     rankdir="TD";  
      A; B;
      A -> B;
  }
  subgraph cluster1 {
    rankdir="BT"; // this doesn't produce the desired output 
      C; D;
      D -> C;
  }
}

hypothetical output from Graphviz

graphviz dot
1个回答
0
投票

您不能这样做,rankdir仅在顶层(图形)被允许

但是在简单的情况下,您可以通过]解决它>

朝相反方向走:

C->D[dir=back]

进入侧面:

{rank=same C D}
© www.soinside.com 2019 - 2024. All rights reserved.