更改图形的大小(宽度和高度)(GraphViz & dot) [英] Change Size (Width and Height) of Graph (GraphViz & dot)
问题描述
通常,GraphViz 用点语言绘制的图形的默认布局有点紧".视觉空间太小,很难在边上放置有意义的标签,而且图表看起来很杂乱.
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.
如何影响GraphViz/点图的垂直和水平间距?
How do I affect the vertical and horizontal spacing of GraphViz / dot graphs?
推荐答案
DEFAULT
我将从一个由点引擎以默认方式布置的简单图形开始:
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
}
如您所见,布局非常紧凑.请注意,我的排名(行)自然地从上到下.我可以通过利用这一点并使用 ranksep
(等级分离)变量来显式设置等级之间的空间来影响图的高度:
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
}
最后,我们可能想扩大图表.这里我们使用nodesep
变量来增加节点(列)之间的空间:
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屋!