如何在graphviz中强制节点位置(x和y) [英] How to force node position (x and y) in graphviz

查看:565
本文介绍了如何在graphviz中强制节点位置(x和y)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试强制节点的位置.我有节点的x和y坐标及其有向图.我可以使用rank = same来处理行(y坐标),但无法弄清楚如何处理列(x坐标).

I am trying to force position of nodes. I have x and y coordinates of my nodes and its also directed graph. I can use the rank=same to handle row (y coordinate), but can't figure out how I can handle column (x coordinate).

推荐答案

您可以使用 pos 属性(

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!"
]

您还必须指定neatofdp布局引擎,以便dot命令行为(对于fdp):

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

这篇关于如何在graphviz中强制节点位置(x和y)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆