更改图形的大小(宽度和高度)(GraphViz& dot) [英] Change Size (Width and Height) of Graph (GraphViz & dot)
问题描述
我如何影响GraphViz /点图的垂直和水平间距?
DEFAULT
由点引擎以默认方式布置:
digraph {
node [shape = circle,width = 0.4];
A-> B
A-> D
B-> C
D-> E
}
改变高度
正如您所看到的,布局非常紧凑。请注意,我的排名(行)自然是从上到下。我可以通过利用这个并使用 ranksep
(rank separation)变量显式地设置行列之间的空间来影响图的 height :
digraph {
node [shape = circle,width = 0.4];
ranksep = 1;
A-> B
A-> D
B-> C
D-> E
}
改变宽度
最后,我们可能想拓宽图表。这里我们使用 nodesep
变量来增加节点(列)之间的空间:
digraph {
node [shape = circle,width = 0.4];
nodesep = 1.5;
A-> B
A-> D
B-> C
D-> E
}
Often, the default layout of graphs drawn by GraphViz in the dot language is a little "tight." With too little visual space, it's hard to put meaningful labels on edges and the graph can look cluttered.
How do I affect the vertical and horizontal spacing of GraphViz / dot graphs?
DEFAULT
I will start with a simple graph that is laid out by the dot engine in the default manner:
digraph {
node [shape=circle, width=0.4];
A->B
A->D
B->C
D->E
}
CHANGING HEIGHT
As you can see, the layout is quite tight. Notice that my ranks (rows) naturally go from top to bottom. I can affect the height of the graph by exploiting this and using the ranksep
(rank separation) variable to explicitly set the space between the ranks:
digraph {
node [shape=circle, width=0.4];
ranksep = 1;
A->B
A->D
B->C
D->E
}
CHANGING WIDTH
Finally, we may want to widen the diagram. Here we use the nodesep
variable to increase the space between the nodes (columns):
digraph {
node [shape=circle, width=0.4];
nodesep=1.5;
A->B
A->D
B->C
D->E
}
这篇关于更改图形的大小(宽度和高度)(GraphViz& dot)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!