如何在使用neato的GraphViz中为具有"splines=curved"的边设置弯曲方向?

8

我正在创建一个图表,其中包含手动定位的节点,并使用splines="curved"类型的边连接它们。

digraph graphname {
  splines="curved";
  node[shape = box, margin="0.03,0.03", fontsize=11, height=0.1, width=0.1,  fixedsize=false];

  "LeftFoot\nRightHand" [pos="-150,-150!"];
  "RightFoot\nRightHand" [pos="-90,-150!"];
  "LeftFoot\nRightFoot" [pos="0,-150!"];
  ...

  edge[style = solid,fontsize=11];
  "LeftFoot\nRightFoot":n -> "RightFoot\nRightHand":n [label = "3", penwidth = 1, color = "red"];
  "LeftFoot\nRightFoot":s -> "LeftFoot\nRightHand":s [label = "7", penwidth = 1, color = "red"];
  ...
}

问题是其中一条边弯曲到了错误的方向,因此它穿过了一个节点: Screenshot from graph 有没有简单的方法来解决这个问题,例如在TikZ中使用“向左弯曲”或“向右弯曲”?
我尝试使用pos属性在边缘上设置样条控制点来改变弯曲,但是这似乎根本不会改变边缘。
1个回答

1
在Graphviz 2.38中,这个问题似乎已经被解决了。我稍微调整了pos的比例,但是其他代码保持不变:
Dot源码:
digraph graphname {
  splines="curved";
  node[shape = box, margin="0.03,0.03", fontsize=11, height=0.1, width=0.1,  fixedsize=false];

  "LeftFoot\nRightHand" [pos="-2,-2!"];
  "RightFoot\nRightHand" [pos="-1.2,-2!"];
  "LeftFoot\nRightFoot" [pos="0,-2!"];

  edge[style = solid,fontsize=11];
  "LeftFoot\nRightFoot":n -> "RightFoot\nRightHand":n [label = "3", penwidth = 1, color = "red"];
  "LeftFoot\nRightFoot":s -> "LeftFoot\nRightHand":s [label = "7", penwidth = 1, color = "red"];

}

命令:

dot -Kneato -Tpng input.gv > output.png

输出:
在此输入图像描述


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接