# How to prevent fdp/neato from flipping coordinates?

**URL:** <https://forum.graphviz.org/t/how-to-prevent-fdp-neato-from-flipping-coordinates/698>\
**Category:** Uncategorized\
**Created:** [June 10, 2021, 5:38pm UTC](https://forum.graphviz.org/t/how-to-prevent-fdp-neato-from-flipping-coordinates/698 "2021-06-10T17:38:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronman](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@ronman](https://forum.graphviz.org/u/ronman)\
**Post date:** [June 10, 2021, 5:38pm UTC](https://forum.graphviz.org/t/how-to-prevent-fdp-neato-from-flipping-coordinates/698/1 "2021-06-10T17:38:52Z")

</div>

I’m attempting to pin nodes and just re-route the edges. Unfortunately, it’s flipping the Y-axis for nodes.

According to the docs at:  
https://graphviz.org/doc/info/attrs.html#d:pin  
nodes can be pinned with neato or fdp, though with a caveat about the origin being translated.

> After 27 Feb 2014, this translation can be avoided in `neato` by setting `notranslate=true`. However, if the graph specifies node overlap removal or a change in aspect `ratio`, node coordinates may still change.

I’m using graphviz 2.40 and put in ‘notranslate’ and tried it with both neato and fdp. Still, the Y-axis flips.

Here’s my input.gv file:

> digraph IdeaTree {  
> graph [notranslate=“true” dpi=“72”]  
> node [pin=“true” fixedsize=“true”]  
> “36047” [pos=“196.94,-659.51!” width=“5.40” height=“3.67” label=“qwer”]  
> “36046” [pos=“163.06,-132.49!” width=“5.40” height=“3.67” label=“123”]  
> “36047” → “36046”  
> }

As you can see, there’s no overlap or ratio given, per the warning in the docs.

But if run by:

> fdp -s72 -v -Tjson -o out.json input.gv  
> or  
> neato -n -v -Tjson -o out.json input.gv

It generates JSON output of (showing only the relevant parts):

> ```
> "label": "qwer",
> "pin": "true",
> "id": "36047",
> "pos": "227.94, 132.49"
> 
> "label": "123",
> "pin": "true",
> "id": "36046",
> "pos": "194.06, 659.51"
> 
> ```

The x-coords are adjusted somewhat by graphviz, but notice how the y-coords are exchanged between the two nodes, effectively flipping my graph upside down, rotating it around the x-axis…

How can I get nodes to actually pin?

---

<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 10, 2021, 6:51pm UTC](https://forum.graphviz.org/t/how-to-prevent-fdp-neato-from-flipping-coordinates/698/2 "2021-06-10T18:51:05Z")

</div>

Use a newer version of Graphviz.  
2.40 is rather old. You’ll get the correct answer with `neato - graphviz version 2.43.0` or newer.

```auto
      "fixedsize": "true",
      "height": "3.6667",
      "label": "qwer",
      "pin": "true",
      "pos": "196.94,-659.51",
      "width": "5.4028"

```

---

<div class="post-metadata">

**Author:** ![ronman](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@ronman](https://forum.graphviz.org/u/ronman)\
**Post date:** [June 12, 2021, 7:40pm UTC](https://forum.graphviz.org/t/how-to-prevent-fdp-neato-from-flipping-coordinates/698/3 "2021-06-12T19:40:07Z")

</div>

Yes, that did it. I upgraded to 2.47 and the problem went away.

Many thanks.
