更改图形的大小(宽度和高度)(GraphViz& dot) [英] Change Size (Width and Height) of Graph (GraphViz & dot)

查看:2037
本文介绍了更改图形的大小(宽度和高度)(GraphViz& dot)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,GraphViz在点语言中绘制的默认图表布局有点紧张。如果视觉空间太小,很难在边缘添加有意义的标签,并且图形看起来很混乱。



我如何影响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屋!

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