我使用Graphviz绘制格子 节点是一组数字。
作为一个点阵,我希望节点的高度位置(y)表示节点所代表的集合中的元素数量。那么x位置应该由graphviz定义,以使表示更清晰。
有可能吗?
根据点文档,应该有属性pos,它应该定义节点的位置。但是,尽管我以许多不同的方式尝试了很多次,但我无法获得定义节点位置的任何图形。有没有人对此有任何成功?
以下是我使用的经典点文件:
digraph G {
"528 544\n640 768" -> "768 528";
"528 536\n530 539" -> "539";
"528 536\n530 539" -> "528";
"800 896 548\n944 566 728\n539 704 768" -> "704 768\n539 548";
"800 896 548\n944 566 728\n539 704 768" -> "944 728\n539 566";
"800 896 548\n944 566 728\n539 704 768" -> "944 800\n896 768";
"768 539" -> "768";
"768 539" -> "539";
"768" -> "∅";
"944" -> "∅";
"944 528 536\n530 566 560\n728 656 539" -> "528 536\n530 539";
"944 528 536\n530 566 560\n728 656 539" -> "944 728\n539 566";
"944 528 536\n530 566 560\n728 656 539" -> "944 656\n528 560";
"704 768\n539 548" -> "768 539";
"944 728\n539 566" -> "944";
"944 728\n539 566" -> "539";
"800 896 640\n944 560 528\n544 656 768" -> "528 544\n640 768";
"800 896 640\n944 560 528\n544 656 768" -> "944 656\n528 560";
"800 896 640\n944 560 528\n544 656 768" -> "944 800\n896 768";
"539" -> "∅";
"944 656\n528 560" -> "944";
"944 656\n528 560" -> "528";
"896 640 656 536\n530 728 539 704\n768 800 544 528\n548 944 566 560" -> "800 896 548\n944 566 728\n539 704 768";
"896 640 656 536\n530 728 539 704\n768 800 544 528\n548 944 566 560" -> "944 528 536\n530 566 560\n728 656 539";
"896 640 656 536\n530 728 539 704\n768 800 544 528\n548 944 566 560" -> "800 896 640\n944 560 528\n544 656 768";
"896 640 656 536\n530 728 539 704\n768 800 544 528\n548 944 566 560" -> "768 704 548\n528 530 544\n536 640 539";
"768 528" -> "768";
"768 528" -> "528";
"528" -> "∅";
"768 704 548\n528 530 544\n536 640 539" -> "528 544\n640 768";
"768 704 548\n528 530 544\n536 640 539" -> "704 768\n539 548";
"768 704 548\n528 530 544\n536 640 539" -> "768 528 530\n539 536";
"944 800\n896 768" -> "768";
"944 800\n896 768" -> "944";
"768 528 530\n539 536" -> "528 536\n530 539";
"768 528 530\n539 536" -> "768 539";
"768 528 530\n539 536" -> "768 528";
}
如果有人可以编写一个文件的例子,其中定义了一个节点的高度,我将非常感激。
答案 0 :(得分:7)
我找到了答案。
下面: http://www.linuxdevcenter.com/pub/a/linux/2004/05/06/graphviz_dot.html?page=2
基本上,可以定义哪些节点集应该在同一高度。 要使节点A和B处于同一高度,我需要添加以下行: {秩=相同; A B};
所以这里是一个类似前面的例子,但节点设置正确:
digraph G {
{rank=same; "768" "944" "539" "528" };
{rank=same; "768 539" "768 528" };
{rank=same; "768 640\n528 544" "528 536\n530 539" "768 704\n539 548" "944 728\n539 566" "944 656\n528 560" "944 800\n896 768" };
{rank=same; "800 896 548\n944 566 728\n539 704 768" "528 944 536\n530 566 560\n728 656 539" "800 896 944\n656 560 528\n544 640 768" "768 640 548\n528 530 544\n536 539 704" };
"768 640\n528 544" -> "768 528";
"528 536\n530 539" -> "539";
"528 536\n530 539" -> "528";
"800 896 548\n944 566 728\n539 704 768" -> "768 704\n539 548";
"800 896 548\n944 566 728\n539 704 768" -> "944 728\n539 566";
"800 896 548\n944 566 728\n539 704 768" -> "944 800\n896 768";
"768 539" -> "768";
"768 539" -> "539";
"768" -> "∅";
"944" -> "∅";
"528 944 536\n530 566 560\n728 656 539" -> "528 536\n530 539";
"528 944 536\n530 566 560\n728 656 539" -> "944 728\n539 566";
"528 944 536\n530 566 560\n728 656 539" -> "944 656\n528 560";
"768 704\n539 548" -> "768 539";
"944 728\n539 566" -> "944";
"944 728\n539 566" -> "539";
"800 896 944\n656 560 528\n544 640 768" -> "768 640\n528 544";
"800 896 944\n656 560 528\n544 640 768" -> "944 656\n528 560";
"800 896 944\n656 560 528\n544 640 768" -> "944 800\n896 768";
"539" -> "∅";
"944 656\n528 560" -> "944";
"944 656\n528 560" -> "528";
"896 640 656 536\n530 728 539 704\n768 800 544 528\n548 944 566 560" -> "800 896 548\n944 566 728\n539 704 768";
"896 640 656 536\n530 728 539 704\n768 800 544 528\n548 944 566 560" -> "528 944 536\n530 566 560\n728 656 539";
"896 640 656 536\n530 728 539 704\n768 800 544 528\n548 944 566 560" -> "800 896 944\n656 560 528\n544 640 768";
"896 640 656 536\n530 728 539 704\n768 800 544 528\n548 944 566 560" -> "768 640 548\n528 530 544\n536 539 704";
"768 528" -> "768";
"768 528" -> "528";
"528" -> "∅";
"768 640 548\n528 530 544\n536 539 704" -> "768 640\n528 544";
"768 640 548\n528 530 544\n536 539 704" -> "768 704\n539 548";
"768 640 548\n528 530 544\n536 539 704" -> "528 768 530\n539 536";
"944 800\n896 768" -> "768";
"944 800\n896 768" -> "944";
"528 768 530\n539 536" -> "528 536\n530 539";
"528 768 530\n539 536" -> "768 539";
"528 768 530\n539 536" -> "768 528";
}