减少graphviz生成的图形的大小(如区域) [英] Reducing the size (as in area) of the graph generated by graphviz

查看:2221
本文介绍了减少graphviz生成的图形的大小(如区域)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都有任何一般的提示,以减少graphviz生成的图形的大小(大小为面积,而不是文件大小)。

Does anyone have any general tips for reducing the size of a graph generated by graphviz (size as in area, not as in file size).

相当大的图(700个节点)。我为每个节点设置较小的字体大小,但它似乎只减少字体大小,而不是实际的节点大小。是否有任何属性来减少图表中的空白总量?非常感谢!

I have a fairly large graph (700 nodes). I set a smaller font size for each node, but it seems to only reduce the font size and not the actual node size. Are there any attributes to reduce the overall amount of blank space in the graph also? Thanks!

推荐答案

在我使用graphviz渲染这种大小的图形调整这种属性设置的组合 - 对于所有三个对象(图形,节点和边缘),一些结构性的,一些纯粹的审美 - 应该做你想要的:

In my experience using graphviz to render graphs of that size (~ 700 nodes), minimal trial-and-error adjustment to this combination of attribute settings--some structural, some purely aesthetic--for all three objects (graph, nodes, and edges) should do what you want:

减少节点之间的最小间隔,通过nodesep;例如, nodes [nodesep = 0.75] ;这将使你的图形太紧凑。 ( nodesep ranksep 可能会影响点的绘制比任何其他可调参数更多)

reduce the minimum separation between nodes, via 'nodesep'; e.g., nodes[nodesep=0.75]; this will make your graph being "too compact." (nodesep and ranksep probably affect how dot draws a graph more than any other adjustable parameter)

减少不同秩的节点之间的最小距离,例如,节点[ranksep = 0.75] ; 'ranksep'设置不同排名的节点之间的最小距离 - 如果你的图由很多等级组成,这将会显着影响你的图布局

reduce the minimum distance between nodes of different ranks, e.g, nodes[ranksep=0.75]; 'ranksep' sets the minimum distance between nodes of different ranks--this will affect your graph layout significantly if your graph is comprised of many ranks

增加边权重,例如, edge [weight = 1.2] ;这将使边更短,从而使整个图更紧凑

increase the edge weights, eg, edge[weight=1.2]; this will make the edges shorter, in turn making the entire graph more compact

删除节点边界和节点填充,例如,节点[color = none; shape = plaintext] ,特别是对于椭圆形节点,总节点空间的大部分是未使用(即,不用于显示节点标签)。每个节点的足迹现在减少到只是其文本

remove node borders and node fill, e.g., nodes[color=none; shape=plaintext], especially for oval-shaped nodes, a substantial fraction of the total node space is 'unused' (ie, not used to display the node label); each node's footprint is now reduced to just its text

显式设置节点的字体大小(节点边界被放大,节点文本,这意味着给定节点的字体大小和文本量对其大小有显着影响); [fontsize = 11]应该足够大以清晰可辨,同时减少混乱外观(默认大小为14)

explicitly set the font size for the nodes (the node borders are enlarged so that they surround the node text, which means that the font size and amount of text for a given node has a significant effect on its size); [fontsize=11] should be large enough to be legible yet also reduce the 'cluttered' appearance (the default size is 14)

和边缘 - 这将使您的图形更容易阅读;例如,将节点文本fontcolor设置为蓝色,将边缘fontcolor设置为灰色,以帮助眼睛区分两组图形结构。

use different colors for nodes and edges--this will make your graph easier to read; e.g., set the node 'text' fontcolor to blue and the edge fontcolor to "grey" to help the eye distinguish the two sets of graph structures. This will make a bigger difference than you might think.

显式设置总图大小,例如, graph [size =7.75 ,10.25] (确保您的图形适合在8.5 x 11的页面上,并占据整个空间)

explicitly set total graph size, eg, graph[size="7.75,10.25"] (ensures that your graph fits on an 8.5 x 11 page and that it occupies the entire space)

这篇关于减少graphviz生成的图形的大小(如区域)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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