我想要实现a)垂直边缘标签或b)水平延伸树,以便在单个A4页面上拟合此图形。我该怎么做?
digraph g {
node[shape=point]
root -> 1 [label = "abcdefghijklmnopqrstuvwxyz$"]
root -> 2 [label = "bcdefghijklmnopqrstuvwxyz$"]
root -> 3 [label = "cdefghijklmnopqrstuvwxyz$"]
root -> 4 [label = "defghijklmnopqrstuvwxyz$"]
root -> 5 [label = "efghijklmnopqrstuvwxyz$"]
root -> 6 [label = "fghijklmnopqrstuvwxyz$"]
root -> 7 [label = "ghijklmnopqrstuvwxyz$"]
root -> 8 [label = "hijklmnopqrstuvwxyz$"]
root -> 9 [label = "ijklmnopqrstuvwxyz$"]
root -> 10 [label = "jklmnopqrstuvwxyz$"]
root -> 11 [label = "klmnopqrstuvwxyz$"]
root -> 12 [label = "lmnopqrstuvwxyz$"]
root -> 13 [label = "mnopqrstuvwxyz$"]
root -> 14 [label = "nopqrstuvwxyz$"]
root -> 15 [label = "opqrstuvwxyz$"]
root -> 16 [label = "pqrstuvwxyz$"]
root -> 17 [label = "qrstuvwxyz$"]
root -> 18 [label = "rstuvwxyz$"]
root -> 19 [label = "stuvwxyz$"]
root -> 20 [label = "tuvwxyz$"]
root -> 21 [label = "uvwxyz$"]
root -> 22 [label = "vwxyz$"]
root -> 23 [label = "wxyz$"]
root -> 24 [label = "xyz$"]
root -> 25 [label = "yz$"]
root -> 26 [label = "z$"]
root -> 27 [label = "$"]
}
答案 0 :(得分:2)
rankdir = LR可以让你把它放在一个页面上
digraph g {
graph[rankdir=LR]
node[shape=point]
root -> 1 [label = "abcdefghijklmnopqrstuvwxyz$"]
root -> 2 [label = "bcdefghijklmnopqrstuvwxyz$"]
...
}
答案 1 :(得分:0)
我刚刚在网上发现的一个解决方法是用'\ n'分隔每个字符(例如换行符)。它不漂亮,但它基本上实现了垂直边缘标签:
例如:
root -> 1 [label = "f\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz\n$"]
答案 2 :(得分:0)
一种可能性是使用unflatten
实用程序。
例如:
unflatten -l 8 yourdotfile.gv | dot | neato -s -n2 -Tpng -o result.png
结果图表不像以前那么宽。