1

我正在使用 graphviz 及其circo提供的工具生成一个图表。

生成的图是一个很好的形状,但是节点之间的边的长度比它们需要的长得多,这使得节点的文本很小(相对于输出图像)并且很难阅读。

如何使输出图像中的节点(相对)更大,以便节点内的文本更易于阅读,

输出图像:

在此处输入图像描述

源图文件:

digraph G {
    FoundUrlToFollow [shape=box];
    "Fetch the URL" [shape=circle];
    FoundUrlToFollow -> "Fetch the URL";
    ResponseReceived [shape=box];
    "Fetch the URL" [shape=circle, label=<Fetch the URL>];
    "Fetch the URL" -> ResponseReceived;
    ResponseError [shape=box];
    "Fetch the URL" [shape=circle, label=<Fetch the URL>];
    "Fetch the URL" -> ResponseError;
    ResponseReceived [shape=box];
    "Log response" [shape=circle];
    ResponseReceived -> "Log response";
    ResponseReceived [shape=box];
    "Is the response OK?" [shape=circle];
    ResponseReceived -> "Is the response OK?";
    ResponseOk [shape=box];
    "Is the response OK?" [shape=circle, label=<Is the response<br/>OK?>];
    "Is the response OK?" -> ResponseOk;
    ResponseOk [shape=box];
    "Is the response HTML?" [shape=circle];
    ResponseOk -> "Is the response HTML?";
    HtmlToParse [shape=box];
    "Is the response HTML?" [shape=circle, label=<Is the response<br/>HTML?>];
    "Is the response HTML?" -> HtmlToParse;
    HtmlToParse [shape=box];
    "Parse the HTML to find links" [shape=circle];
    HtmlToParse -> "Parse the HTML to find links";
    FoundUrl [shape=box];
    "Parse the HTML to find links" [shape=circle, label=<Parse the HTML<br/>to find links>];
    "Parse the HTML to find links" -> FoundUrl;
    FoundUrl [shape=box];
    "Should we follow this URL?" [shape=circle];
    FoundUrl -> "Should we follow this URL?";
    FoundUrlToSkip [shape=box];
    "Should we follow this URL?" [shape=circle, label=<Should we<br/>follow this<br/>URL?>];
    "Should we follow this URL?" -> FoundUrlToSkip;
    FoundUrlToFollow [shape=box];
    "Should we follow this URL?" [shape=circle, label=<Should we<br/>follow this<br/>URL?>];
    "Should we follow this URL?" -> FoundUrlToFollow;
    FoundUrlToSkip [shape=box];
    "Log skipped links" [shape=circle];
    FoundUrlToSkip -> "Log skipped links";
    graph [label="Switches are circles. Events are boxes.", fontsize="12", overlap=scale];
    edge [splines=curved];
}

命令:

circo -Tpng -ograph_so.png graph.dot
4

2 回答 2

2

我会尝试将mindist(小于 1)添加到图表中:

graph [..., overlap=scale, mindist=.6];

[编辑]

也许渲染器版本会有所不同:这是我机器上的结果

在此处输入图像描述

于 2017-01-05T21:44:56.943 回答
1

尝试改变-Gsize(英寸单位)和-Gdpi. 您会发现,如果同时更改它们,您将获得具有相同像素大小的不同输出,但节点之间的间距相对于节点本身的大小不同。-Gnodesep-Nfontsize可能对调整有用。通过渲染为 EPS 或 PDF 或 SVG,然后将其转换为 PNG,而不是使用 Graphviz 的 PNG 渲染器,您可能也会有更好的运气。根据我的经验,从 Graphviz 获得令人愉悦的输出是一门非常不精确的科学。

于 2017-01-06T08:11:28.697 回答