# How to modify arrow path?

**URL:** <https://forum.graphviz.org/t/how-to-modify-arrow-path/705>\
**Category:** Help\
**Created:** [June 15, 2021, 3:48pm UTC](https://forum.graphviz.org/t/how-to-modify-arrow-path/705 "2021-06-15T15:48:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ooker](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/ooker/32/385_2.png) [@Ooker](https://forum.graphviz.org/u/Ooker)\
**Post date:** [June 15, 2021, 3:48pm UTC](https://forum.graphviz.org/t/how-to-modify-arrow-path/705/1 "2021-06-15T15:48:18Z")

</div>

How to have arrow 2 have the same shape as arrow 1?

[![enter image description here](https://global.discourse-cdn.com/graphviz/original/1X/3e8f7f8197462c5b9a5810e79e0e1fb08a7ea82f.png)](https://i.stack.imgur.com/KHAqK.png)

```auto
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](https://stackoverflow.com/questions/67985475/how-to-modify-arrow-path?noredirect=1#comment120165019_67985475) 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?

---

<div class="post-metadata">

**Author:** ![jjlong](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/jjlong/32/887_2.png) [@jjlong](https://forum.graphviz.org/u/jjlong)\
**Post date:** [June 15, 2021, 8:29pm UTC](https://forum.graphviz.org/t/how-to-modify-arrow-path/705/2 "2021-06-15T20:29:56Z")

</div>

> [@Ooker](#):
>
> ```auto
> 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]
> }
> 
> ```

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:

```auto
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:

 ![gvforum](https://global.discourse-cdn.com/graphviz/original/1X/f1ae5f0caee767fa5698eac6cffe57b7beca896a.png)

I hope this helps,  
Jeff

---

<div class="post-metadata">

**Author:** ![jjlong](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/jjlong/32/887_2.png) [@jjlong](https://forum.graphviz.org/u/jjlong)\
**Post date:** [June 15, 2021, 8:46pm UTC](https://forum.graphviz.org/t/how-to-modify-arrow-path/705/3 "2021-06-15T20:46:36Z")

</div>

> [@Ooker](#):
>
> By the way, the left arrows can only be that symmetric when I put empty labels to them. Is there any explanation for this?

The length of the label is what is affecting the symmetry. You can achieve symmetry by using `xlabel` instead of `label`. For example:

```auto
a:w -> b:w [xlabel="this is a really really really long label" dir=both]
a:w -> c:w [label=" " dir=both]
b:w -> c:w [xlabel="short label" dir=both]

```

This change makes the graph appear as follows:

 ![gvforum](https://global.discourse-cdn.com/graphviz/original/1X/33fa3e17db7ca31f2b1f42393d1c69ddb348ff19.png)

---

<div class="post-metadata">

**Author:** ![Ooker](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/ooker/32/385_2.png) [@Ooker](https://forum.graphviz.org/u/Ooker)\
**Post date:** [June 16, 2021, 7:44am UTC](https://forum.graphviz.org/t/how-to-modify-arrow-path/705/4 "2021-06-16T07:44:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![eyssette](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/eyssette/32/103_2.png) [@eyssette](https://forum.graphviz.org/u/eyssette)\
**Post date:** [August 7, 2021, 10:56pm UTC](https://forum.graphviz.org/t/how-to-modify-arrow-path/705/5 "2021-08-07T22:56:21Z")

</div>

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.

```graphviz
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]}
}

```

 ![graphviz (2)](https://global.discourse-cdn.com/graphviz/original/1X/1e4034010e6d73aaaa1483d97012374250067e2d.png)
