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 settingnotranslate=true
. However, if the graph specifies node overlap removal or a change in aspectratio
, 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?