How to force node position (x and y) in graphviz

↘锁芯ラ 提交于 2019-11-27 03:37:35
Andrey

You can use pos attribute (https://www.graphviz.org/doc/info/attrs.html#d:pos), e.g.:

xxx [
    label = xxx
    pos = "0,0!"
]

yyy [
    label = yyy
    pos = "10,10!"
]

You will also have to specify neato or fdp layout engine, so that dot command-line would be (for fdp):

dot -Kfdp -n -Tpng -o sample.png sample.dot

I couldn't get the -n flag work with dot -Kfdp.

I was however able to get it working with neato using the following command:

neato sample.dot -n -Tpng -o sample.png

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!