# Render arrowheads always horizontally

**URL:** <https://forum.graphviz.org/t/render-arrowheads-always-horizontally/2354>\
**Category:** Help\
**Created:** [July 24, 2024, 3:47pm UTC](https://forum.graphviz.org/t/render-arrowheads-always-horizontally/2354 "2024-07-24T15:47:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bugzpodder](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@bugzpodder](https://forum.graphviz.org/u/bugzpodder)\
**Post date:** [July 24, 2024, 3:47pm UTC](https://forum.graphviz.org/t/render-arrowheads-always-horizontally/2354/1 "2024-07-24T15:47:17Z")

</div>

I am playing around with [Floorplan](https://github.com/softwaretechnik-berlin/dbml-renderer/blob/master/src/renderer.ts) which uses graphviz under the hood and trying to figure out how to get this kind of edges. The edges seems cuved (spline=cuved/true) but the arrows are merged into one, they always start and end horizontally but can curve in the middle.  
Here is an example from floorplan output:  
[here](https://pasteboard.co/mjFP1La6c0MW.png)

I am trying to do this myself directly in graphviz (python) but no dice so far:  
[here](https://pasteboard.co/jMvOuUddfp2X.png)  
the edge arrows are at some kind of 45 degree angle

any suggestions are appreciated!

edit: just found an example on graphviz gallery, looks like i have to use dot engine and splines=true instead of curved… and rankdir=LR

[dot]

```auto
digraph g {
fontname="Helvetica,Arial,sans-serif"
node [fontname="Helvetica,Arial,sans-serif"]
edge [fontname="Helvetica,Arial,sans-serif"]
graph [
rankdir = "LR"
];
node [
fontsize = "16"
shape = "plaintext"
];
edge [
];
"node0" [
label = "<f0> 0x10ba8| <f1>"
shape = "record"
];
"node1" [
label = "<f0> 0xf7fc4380| <f1> | <f2> |-1"
shape = "record"
];
"node2" [
label = "<f0> 0xf7fc44b8| | |2"
shape = "record"
];
"node3" [
label = "<f0> 3.43322790286038071e-06|44.79998779296875|0"
shape = "record"
];
"node4" [
label = "<f0> 0xf7fc4380| <f1> | <f2> |2"
shape = "record"
];
"node5" [
label = "<f0> (nil)| | |-1"
shape = "record"
];
"node6" [
label = "<f0> 0xf7fc4380| <f1> | <f2> |1"
shape = "record"
];
"node7" [
label = "<f0> 0xf7fc4380| <f1> | <f2> |2"
shape = "record"
];
"node8" [
label = "<f0> (nil)| | |-1"
shape = "record"
];
"node9" [
label = "<f0> (nil)| | |-1"
shape = "record"
];
"node10" [
label = "<f0> (nil)| <f1> | <f2> |-1"
shape = "record"
];
"node11" [
label = "<f0> (nil)| <f1> | <f2> |-1"
shape = "record"
];
"node12" [
label = "<f0> 0xf7fc43e0| | |1"
shape = "record"
];
"node0":f0 -> "node1":f0 [
id = 0
];
"node0":f1 -> "node2":f0 [
id = 1
];
"node1":f0 -> "node3":f0 [
id = 2
];
"node1":f1 -> "node4":f0 [
id = 3
];
"node1":f2 -> "node5":f0 [
id = 4
];
"node4":f0 -> "node3":f0 [
id = 5
];
"node4":f1 -> "node6":f0 [
id = 6
];
"node4":f2 -> "node10":f0 [
id = 7
];
"node6":f0 -> "node3":f0 [
id = 8
];
"node6":f1 -> "node7":f0 [
id = 9
];
"node6":f2 -> "node9":f0 [
id = 10
];
"node7":f0 -> "node3":f0 [
id = 11
];
"node7":f1 -> "node1":f0 [
id = 12
];
"node7":f2 -> "node8":f0 [
id = 13
];
"node10":f1 -> "node11":f0 [
id = 14
];
"node10":f2 -> "node12":f0 [
id = 15
];
"node11":f2 -> "node1":f0 [
id = 16
];
}

```

[/dot]

---

<div class="post-metadata">

**Author:** ![scnorth](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/scnorth/32/89_2.png) [@scnorth](https://forum.graphviz.org/u/scnorth)\
**Post date:** [July 24, 2024, 5:33pm UTC](https://forum.graphviz.org/t/render-arrowheads-always-horizontally/2354/2 "2024-07-24T17:33:34Z")

</div>

That would be a cool feature. The spline router API already supports this and it’s used to make concentrators. Look for `start.theta` and `end.theta` in for example lib/common/splines.c (the layer that calls the basic spline router).

Someone noticed recently there was a hook in the graphviz grammar intended for setting the angle of edge endpoints, e.g.  
`a@0 -> b@180`. This was never thought through or implemented. Anyway, the point isn’t to give absolute values - it’s to ask for horizontal or vertical slopes. This could also be controlled by an edge attribute. It seems like a nice little introductory intern-level project.

---

<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:** [July 24, 2024, 6:19pm UTC](https://forum.graphviz.org/t/render-arrowheads-always-horizontally/2354/3 "2024-07-24T18:19:30Z")

</div>

- setting **splines=ortho** will _guarantee_ (pretty sure) horizontal/vertical arrowheads
- setting **splines=false** will _guarantee_ a _minimum_ of horizontal/vertical arrowheads
- setting **splines=true** is so/so for horizontal/vertical arrowheads

@scnorth’s solution would provide this feature to all

Or you might be able to accomplish it with some Python post-processing code - the tail of an arrowhead is well defined, so tweaking that value and then getting the line itself to match up is doable. Hmmm.
