[英]Swap positions of two nodes in a GraphViz diagram (DOT)
I use the DOT
language to create a diagram in R
. 我使用
DOT
语言在R
创建图。 As I get a strange result, I am interested how to swap positions of two nodes: node 8 and node c4? 当我得到一个奇怪的结果时,我对如何交换两个节点的位置感兴趣:节点8和节点c4?
The code: 编码:
digraph DAG {
# Initialization of node attributes
node [shape = box, color = blue]; 2; 3; 4;
# Revision to node attributes
{ node [shape = box,style = filled,fillcolor = yellow]; 8}
# Revision to node attributes
{ node [shape = diamond, color = "red"]; c1; c2; c3; c4}
{ rank=same; c1; c2; c3}
{ rank=same; 8; c4}
# Initialization of edge attributes
edge [color = green, rel = yields]
# Edge statements
2->c1 [headport = w];
c1->c2->c3
c2->c1 [tailport = n, headport = n];
8->c3 [tailport = n, headport = s];
c3->3 [tailport = e, headport = n];
c3->c2 [tailport = n, headport = n];
3->c4 [tailport = s, headport = n];
c4->4 [tailport = s, headport = n];
c4->8 [tailport = w, headport = e];
}
The (incorrect) result is: (不正确的)结果是:
for "wrong way" edges you may 对于“错误的方式”边缘,您可能
dir = back
to invert its 'force' dir = back
反转其“力” constraint = none
to disable its 'force' constraint = none
禁用其“强制” in your case you substitute 在你的情况下,你替代
8->c4 [tailport = e, headport = w, dir = back];
by either 由任一
c4->8 [tailport = w, headport = e, constraint = none];
or by 或
8->c4 [tailport = e, headport = w, dir = back];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.