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

查看:49
本文介绍了减少由 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 渲染该大小(约 700 个节点)的图形的经验,对这种属性设置组合的反复试验调整最少——一些结构,一些纯粹的美学——对于所有三个对象(图形、节点和边缘)应该做你想做的:

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];这将使您的图表过于紧凑".(nodesepranksep 可能比任何其他可调参数更能影响点绘制图形的方式)

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)

减少不同等级节点之间的最小距离,例如,nodes[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

移除节点边框和节点填充,例如,nodes[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)

为节点和边使用不同的颜色--这将使您的图表更易于阅读;例如,将节点text"的字体颜色设置为蓝色,将边的字体颜色设置为灰色",以帮助眼睛区分两组图形结构.这将产生比您想象的更大的差异.

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天全站免登陆