# Allign node's stroke with end of the arrow's path width

**URL:** <https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462>\
**Category:** Uncategorized\
**Created:** [November 28, 2020, 9:46am UTC](https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462 "2020-11-28T09:46:46Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![luttik](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/luttik/32/277_2.png) [@luttik](https://forum.graphviz.org/u/luttik)\
**Post date:** [November 28, 2020, 9:46am UTC](https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462/1 "2020-11-28T09:46:46Z")

</div>

Hi all,

When you have graphs with a significant edgewidth.

for instance:

```
digraph {
    A -> B [penwidth=10]
}

```

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

It seems like the fill of the arrow-head aligns with the fill of the nodes shape, i.e. the stroke or border of the arrow overlaps significantly with the node…

Is there a way to counteract this behavior, e.g. using a do-not-overlap setting or manually adding an offset between the arrowhead and the node.

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [November 28, 2020, 5:22pm UTC](https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462/2 "2020-11-28T17:22:22Z")

</div>

Yep, looks like a bug to me. You get the same result with **png** and **svg**. I’m surprised this hasn’t been reported before.  
The only work-around I found was this:

1. **dot -T dot yourfile.gv \>yourfile.dot**
2. edit all the **pos** values for edges with **penwidth** \>1 (see [Attributes | Graphviz](https://www.graphviz.org/doc/info/attrs.html#k:splineType) and example below)
3. **neato -n2 -Tpng youreditedfile.dot \>yourfile.png**

(See also the FAQ - [FAQ | Graphviz](https://www.graphviz.org/faq/#FaqDotWithCoords))

Like so:

```
digraph {
	graph [bb="0,0,54,108"];
	node [label="\N"];
	A	[height=0.5,
		pos="27,90",
		width=0.75];
	B	[height=0.5,
		pos="27,18",
		width=0.75];
	A -> B	[penwidth=10,
		 //pos="e,27,36.104 27,71.697 27,63.983 27,54.712 27,46.112"];
	pos="e,27,44.104 27,71.697 27,63.983 27,54.712 27,46.112"];
}

```

Giving:  
 ![fatEdge0](https://global.discourse-cdn.com/graphviz/original/1X/f96b6e639671446b3e9b2737dc36bcd90006c9b3.png)

---

<div class="post-metadata">

**Author:** ![luttik](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/luttik/32/277_2.png) [@luttik](https://forum.graphviz.org/u/luttik)\
**Post date:** [November 28, 2020, 5:46pm UTC](https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462/3 "2020-11-28T17:46:43Z")

</div>

Well I’ve known about the bug for almost two years. But I just put up with it since I saw no alternatives… I only recently was pointed to the forums

---

<div class="post-metadata">

**Author:** ![dkasak](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/dkasak/32/316_2.png) [@dkasak](https://forum.graphviz.org/u/dkasak)\
**Post date:** [February 13, 2021, 5:15pm UTC](https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462/4 "2021-02-13T17:15:29Z")

</div>

Note that this happens to me even with the most simple of graphs, with the default settings. E.g. see this graph and its PDF output.

```auto
digraph {
    a -> b;
}

```

I personally find it a real eye sore. Another eye sore is that the label of a vertically straight edge touches the edge. Both problems visible in the image below.

 ![image](https://global.discourse-cdn.com/graphviz/original/1X/89eb6ba6c82ee196df2cb0328b7e942c9676245b.png)

---

<div class="post-metadata">

**Author:** ![absalom](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/absalom/32/1085_2.png) [@absalom](https://forum.graphviz.org/u/absalom)\
**Post date:** [June 7, 2023, 9:14am UTC](https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462/5 "2023-06-07T09:14:49Z")

</div>

Hi, starting to work on my slides for teaching graph theory. I was really happy to work with Graphviz for one day until I started creating my first directed graph…

Thus bug is really a no-go for me. I use `penwidth=1.75` for the edges and the nodes, nothing too much for slides.

Is there really nothing new about that bug?

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [June 7, 2023, 12:50pm UTC](https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462/6 "2023-06-07T12:50:35Z")

</div>

Sorry it is a no-go. The issue is being worked. Here is a link to the issue: ([[Output Generation] Failure of arrowhead and arrowtail to respect penwidth (#372) · Issues · graphviz / graphviz · GitLab](https://gitlab.com/graphviz/graphviz/-/issues/372))

---

<div class="post-metadata">

**Author:** ![absalom](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/absalom/32/1085_2.png) [@absalom](https://forum.graphviz.org/u/absalom)\
**Post date:** [June 7, 2023, 1:08pm UTC](https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462/7 "2023-06-07T13:08:13Z")

</div>

Since I work with EPS output, I manually edited the resulting file and noticed I could get acceptable display by leaving `1.75 setlinewidth` for the edge (as initially wanted) but setting something like `0.5 setlinewidth` for the arrow.

Wouldn’t it be possible to add a new attribute for EPS (and maybe SVG) in order to get two different `penwidth` (one for the edge and one for the arrow)?

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [June 7, 2023, 2:26pm UTC](https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462/8 "2023-06-07T14:26:54Z")

</div>

This does not solve your problem, but **setlinewidth** is deprecated, (see [style | Graphviz](https://graphviz.org/docs/attr-types/style/) and [penwidth | Graphviz](https://graphviz.org/docs/attrs/penwidth/))

```auto
The setlinewidth style value can be used for more control over the width of node borders and  
edges than is allowed by bold. This style value takes an argument, specifying the width of the  
line in points. For example, style="bold" is equivalent to style="setlinewidth(2)". The use of  
setlinewidth is deprecated; one should use the penwidth attribute instead.

```

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [June 7, 2023, 2:56pm UTC](https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462/9 "2023-06-07T14:56:54Z")

</div>

It looks like @magjac has made major improvements to this bug (see below).  
What version of Graphviz are you using - `dot -V`. Maybe time to download a new version.

Old result:  
 ![edgeWidthTest0.old](https://global.discourse-cdn.com/graphviz/original/2X/a/ae8bd630846755a5397faac33d46aa9f82c1f1cc.png)

New result:  
 ![edgeWidthTest0](https://global.discourse-cdn.com/graphviz/original/2X/6/6580a6c91a0831a74b0adf104ce4cb865e7f4d90.png)

---

<div class="post-metadata">

**Author:** ![absalom](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/absalom/32/1085_2.png) [@absalom](https://forum.graphviz.org/u/absalom)\
**Post date:** [June 7, 2023, 4:59pm UTC](https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462/10 "2023-06-07T16:59:46Z")

</div>

@steveroush Indeed, my version was very old. Just compiled the last version and it works now. Thank you.
