graphviz 中的表结构

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

是否可以创建一个带有点的图形,其中节点被组织成“严格”的表结构,如下图所示?在这个例子中,每个节点属于某一列,即具有相同功能或标签的节点。每个节点之间的垂直间距是相同的。

enter image description here

我尝试使用该结构,但无法在表中包含节点。

graphviz dot
1个回答
0
投票

这是一种方法 - 显式设置所有节点的 X 和 Y 位置(请参阅 https://graphviz.org/faq/#FaqDotWithNodeCoords )。
如果您是一名程序员,这应该相当容易。下面的例子是手动完成的。

digraph RC {
  node [shape=rect label="" pin=true]
  A [pos="1,7"]
  B [pos="2,6"]
  C [pos="1,5"]
  D [pos="2,4"]
  E [pos="3,3"]
  F [pos="1,2"]
  G [pos="2,1"]
 
  A->B->C->D->E->F->G

  node [width=5]  // inches
  t1[label=" some text goes here"  pos="7,7"]
  t2[label=" some more text goes here"  pos="7,6"]
  t3[label=" even more text goes here"  pos="7,5"]
  t4[label=" some text goes here"  pos="7,4"]
  t5[label=" some text goes here"  pos="7,3"]
  t6[label=" some text goes here"  pos="7,2"]
  t7[label=" last text goes here"  pos="7,1"]
} 

给予:

© www.soinside.com 2019 - 2024. All rights reserved.