windows Graphviz:如何从 .dot 变成图形?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1494492/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:47:01  来源:igfitidea点击:

Graphviz: How to go from .dot to a graph?

windowsgraphvizdot

提问by Nick Heiner

I can't seem to figure this out. I have a .dot file, which is valid according to the syntax. How do I use graphviz to convert this into an image?

我似乎无法弄清楚这一点。我有一个 .dot 文件,根据语法它是有效的。如何使用 graphviz 将其转换为图像?

(note that I'm on Windows, not linux)

(请注意,我使用的是 Windows,而不是 linux)

回答by Paul McMillan

type: dot -Tps filename.dot -o outfile.ps

类型: dot -Tps filename.dot -o outfile.ps

If you want to use the dot renderer. There are alternatives like neato and twopi. If graphiz isn't in your path, figure out where it is installed and run it from there.

如果要使用点渲染器。有像neato和twopi这样的替代品。如果 graphiz 不在您的路径中,请找出它的安装位置并从那里运行它。

You can change the output formatby varying the value after -Tand choosing an appropriate filename extension after -o.

您可以通过改变后的值并在后选择适当的文件扩展名来更改输出格式-T-o

If you're using windows, check out the installed tool called GVEdit, it makes the whole process slightly easier.

如果您使用的是 Windows,请查看已安装的名为 GVEdit 的工具,它使整个过程稍微容易一些。

Go look at the graphviz site in the section called "User's Guides" for more detail on how to use the tools:

有关如何使用这些工具的更多详细信息,请查看“用户指南”部分中的 graphviz 站点:

http://www.graphviz.org/documentation/

http://www.graphviz.org/documentation/

(See page 27 for output formatting for the dot command, for instance)

(例如,有关 dot 命令的输出格式,请参见第 27 页)

http://www.graphviz.org/pdf/dotguide.pdf

http://www.graphviz.org/pdf/dotguide.pdf

回答by user172818

dot -Tps input.dot > output.eps
dot -Tpng input.dot > output.png

PostScript output seems always there. I am not sure if dot has PNG output by default. This may depend on how you have built it.

PostScript 输出似乎总是存在。我不确定默认情况下 dot 是否具有 PNG 输出。这可能取决于您如何构建它。

回答by jbp

dot file.dot -Tpng -o image.png

dot file.dot -Tpng -o image.png

This works on Windows and Linux. Graphviz must be installed.

这适用于 Windows 和 Linux。必须安装 Graphviz。

回答by Seth

Get the graphviz-2.24.msi Graphviz.org. Then get zgrviewer.

获取 graphviz-2.24.msi Graphviz.org。然后得到zgrviewer

Zgrviewer requires java (probably 1.5+). You might have to set the paths to the Graphviz binaries in Zgrviewer's preferences.

Zgrviewer 需要 java(可能是 1.5+)。您可能需要在 Zgrviewer 的首选项中设置 Graphviz 二进制文件的路径。

File -> Open -> Open with dot -> SVG pipeline (standard) ... Pick your .dot file.

File -> Open -> Open with dot -> SVG pipeline (standard) ... 选择你的 .dot 文件。

You can zoom in, export, all kinds of fun stuff.

您可以放大、导出各种有趣的东西。

回答by Michael James Kali Galarnyk

This should combine a lot of answers.

这应该结合很多答案。

# Convert dot to png via graphviz
dot -Tpng filename.dot -o filename.png

# Convert dot to svg via graphviz
dot -Tsvg filename.dot -o filename.svg

# Convert dot to eps via graphviz
dot -Tps filename.dot -o filename.eps

Keep in mind that on OSX (MAC), you need to install homebrewto install graphviz to be able to use the dot commands above.

请记住,在 OSX (MAC) 上,您需要安装homebrew来安装 graphviz 才能使用上面的点命令。

brew install graphviz

It is also possible to install Graphviz (and use the commands above) through the package manager functionality of conda if you have Anaconda installed.

如果您安装了 Anaconda,也可以通过 conda 的包管理器功能安装 Graphviz(并使用上面的命令)。

conda install python-graphviz

回答by innohead

You can also output your file in xdot format, then render it in a browser using canviz, a JavaScript library.

您还可以以 xdot 格式输出文件,然后使用 JavaScript 库 Canviz 在浏览器中呈现它。

Canviz on code.google.com:

在 code.google.com 上的 Canviz

To see an example, there is a "Canviz Demo" link on the page above as of November 2, 2014.

要查看示例,截至 2014 年 11 月 2 日,上面的页面上有一个“Canviz 演示”链接。

回答by Luftatako

there is no requirement of any conversion.

不需要任何转换。

We can simply use xdotcommand in Linux which is an Interactive viewer for Graphviz dot files.

我们可以简单地在 Linux 中使用xdot命令,它是 Graphviz 点文件的交互式查看器。

ex: xdot file.dot

例如:xdot 文件.dot

for more infor:https://github.com/rakhimov/cppdep/wiki/How-to-view-or-work-with-Graphviz-Dot-files

更多信息:https: //github.com/rakhimov/cppdep/wiki/How-to-view-or-work-with-Graphviz-Dot-files

回答by Sanaullah Ahmad

You can use a very good online tool for it. Here is the link dreampuf.github.ioJust replace the code inside editer with your code.

您可以使用一个非常好的在线工具。这是链接 dreampuf.github.io只需将编辑器中的代码替换为您的代码即可。

回答by Abhishek Jain

For window user, Please run complete command to convert *.dot file to png:

对于窗口用户,请运行完整的命令将 *.dot 文件转换为 png:

C:\Program Files (x86)\Graphviz2.38\bin\dot.exe" -Tpng sampleTest.dot > sampletest.png.....

I have found a bug in solgraph that it is utilizing older version of solidity-parser that does not seem to be intelligent enough to capture new enhancement done for solidity programming language itself e.g. emit keyword for Event

我在 solgraph 中发现了一个错误,它使用旧版本的 Solidity-parser,它似乎不够智能,无法捕获为 Solidity 编程语言本身所做的新增强,例如为 Event 发出关键字