How to have arrow 2 have the same shape as arrow 1?
digraph {
rankdir=LR
label = "Lý thuyết ý định hành động";
labelloc = t
labeljust = r
fontsize = 20
fontname = Lato
overlap=false;
a [ label = "Thái độ của\nbản thân đối\nvới hành động" ]
b [ label = "Cảm nhận về\nthế nào là\nchuẩn mực" group=g1]
c [ label = "Cảm nhận về\nkhả năng đạt\nđược kết quả" ]
d [ label = "Có ý định hành động" group=g1 style=rounded shape=polygon ]
e [ label = "Thực sự hành động" group=g1 style=rounded shape=box3d ]
{ rank=same; a, b, c }
a:w -> b:w [ label="" dir=both]
a:w -> c:w [ label=" " dir=both]
b:w -> c:w [ label="" dir=both]
a:e -> d:n [ label="1" ]
b:e -> d:w
c:e -> d:s [ label="2" ]
d -> e
c -> e:s [style=dashed dir=none]
}
One person suggests me to change c -> e:s [style=dashed dir=none] to c:s -> e:s [style=dashed dir=none]. This works for them but still not for me. That’s strange. We both use version 2.47.1. My command is simply dot -Tpng input.gv -o output.png
By the way, the left arrows can only be that symmetric when I put empty labels to them. Is there any explanation for this?
On my monitor node a is 3mm wider than nodes b, and c. This tiny size difference can be throwing off the symmetry you seek. You can try making nodes a, b, and c a fixed size as I have done below. I also added the port from c to d, i.e. c:s -> e:s [style=dashed dir=none]
The source is as follows:
digraph {
rankdir=LR
label = "Lý thuyết ý định hành động";
labelloc = t
labeljust = r
fontsize = 20
fontname = Lato
overlap=false;
a [ label = "Thái độ của\nbản thân đối\nvới hành động" width="2.0" height="1.2" fixedsize="true"]
b [ label = "Cảm nhận về\nthế nào là\nchuẩn mực" group=g1 width="2.0" height="1.2" fixedsize="true"]
c [ label = "Cảm nhận về\nkhả năng đạt\nđược kết quả" width="2.0" height="1.2" fixedsize="true"]
d [ label = "Có ý định hành động" group=g1 style=rounded shape=polygon ]
e [ label = "Thực sự hành động" group=g1 style=rounded shape=box3d ]
{ rank=same; a, b, c }
a:w -> b:w [ label="" dir=both]
a:w -> c:w [ label=" " dir=both]
b:w -> c:w [ label="" dir=both]
a:e -> d:n [ label="1" ]
b:e -> d:w
c:e -> d:s [ label="2" ]
d:e -> e:w
c:s -> e:s [style=dashed dir=none]
}
and using v2.47.0 on Windows creates the following graph:
If I remove the numbering, I still need to label the arrow 2 as " " to have it the same path as 1. I also prefer to have c:e -> e:s instead of c:s -> e:s, since it would take much less space. Even c:se -> e:s still reforms the arrow 2.
I also find a weird bug. In the code, the arrows between node a, b, c (all the left ones) should have both directions. But in images it is not that case. I have to swap the attributes from label="" dir=both to dir=both label="" to have both directions again.
It’s not a perfect solution but you can use nodesep=0.05, add a point shape p1 between c and e, and set the len of your edges with minlen to suit your needs.
digraph {
rankdir=LR
label = "Lý thuyết ý định hành động";
labelloc = t
labeljust = r
fontsize = 20
fontname = Lato
overlap=false;
nodesep=0.05
a [ label = "Thái độ của\nbản thân đối\nvới hành động" ]
b [ label = "Cảm nhận về\nthế nào là\nchuẩn mực" group=g1]
c [ label = "Cảm nhận về\nkhả năng đạt\nđược kết quả" ]
d [ label = "Có ý định hành động" group=g1 style=rounded shape=polygon ]
e [ label = "Thực sự hành động" group=g1 style=rounded shape=box3d ]
{ rank=same; a, b, c }
a:w -> b:w [ label="" dir=both,minlen=4]
a:w -> c:w [ label=" " dir=both]
b:w -> c:w [ label="" dir=both,minlen=4]
a:e -> d:n [ label="1" ]
b:e -> d:w
c:e -> d:s [ label="2" ]
d -> e
c -> p1 -> e:s [style=dashed dir=none]
p1[shape=point,style=invis, width=0.01]
{rank=same;d->p1[minlen=13,style=invis]}
}