简体   繁体   English

Graphviz使用点子图对齐问题

[英]Graphviz using dot subgraph alignment issues

I'm having a hard time trying to figure out how to align two graphs in graphviz. 我很难弄清楚如何在graphviz中对齐两个图形。 I'm using dot and below is the code I'm using. 我正在使用dot ,下面是我正在使用的代码。

digraph {
//rank=same;
q1 [shape="doublecircle"];
q2 [shape="doublecircle"];
q0->q1 
q0->q1 
q0->q1 
q1->q2 

rankdir=LR
node [shape=plaintext]
subgraph cluster_01 {
//rank=sink
label = "key";
key [label=<<table border="0" cellpadding="2" cellspacing="0" cellborder="0">
  <tr><td align="left" port="i1"></td></tr>
  <tr><td align="left" port="i2"></td></tr>
  <tr><td align="left" port="i3"></td></tr>
  <tr><td align="left" port="i4"></td></tr>
  </table>>]
}

I would like the table that is the key to be under the nodes. 我希望该表是节点下的key And I would like my nodes to line up horizontally. 我希望我的节点水平排列。 I've been messing with rank=same to get the nodes to go horizontally and rank=sink to get the key to be under the nodes. 我一直在使用rank=same来使节点水平移动,并使用rank=sink来使key位于节点之下。 Any help is appreciated, I've been stuck on this for too long. 感谢您的任何帮助,我为此坚持了太久了。 Thanks. 谢谢。

To have the node key under the nodes: 要在节点下具有节点key

The order of appearance of the nodes in the script matters. 脚本中节点的出现顺序很重要。 In this case, if you simply define your key before the other nodes ( q0 , q1 , ...), it will appear under those nodes. 在这种情况下,如果仅在其他节点( q0q1 ,...)之前定义key ,它将显示在这些节点下。

The other nodes already align horizontally (they are on the same horizontal line). 其他节点已经水平对齐(它们在同一条水平线上)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM