简体   繁体   English

Graphviz:如何将 go from.dot 转换为图形?

[英]Graphviz: How to go from .dot to a graph?

I can't seem to figure this out.我似乎无法弄清楚这一点。 I have a.dot file, which is valid according to the syntax.我有一个.dot 文件,根据语法它是有效的。 How do I use graphviz to convert this into an image?如何使用 graphviz 将其转换为图像?

(note that I'm on Windows, not linux) (请注意,我使用的是 Windows,而不是 linux)

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.有像neato和twopi这样的替代品。 If graphiz isn't in your path, figure out where it is installed and run it from there.如果 graphiz 不在您的路径中,请找出它的安装位置并从那里运行它。

You can change the output format by varying the value after -T and 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

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

PostScript output seems always there. PostScript 输出似乎总是存在。 I am not sure if dot has PNG output by default.我不确定默认情况下 dot 是否具有 PNG 输出。 This may depend on how you have built it.这可能取决于您如何构建它。

dot file.dot -Tpng -o image.png dot file.dot -Tpng -o image.png

This works on Windows and Linux.这适用于 Windows 和 Linux。 Graphviz must be installed.必须安装 Graphviz。

Get the graphviz-2.24.msi Graphviz.org .获取 graphviz-2.24.msi Graphviz.org Then get zgrviewer .然后得到zgrviewer

Zgrviewer requires java (probably 1.5+). Zgrviewer 需要 java(可能是 1.5+)。 You might have to set the paths to the Graphviz binaries in Zgrviewer's preferences.您可能需要在 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.您可以放大、导出各种有趣的东西。

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 homebrew to 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

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 演示”链接。

You can use the VS code and install the Graphviz extension or,您可以使用 VS 代码并安装 Graphviz 扩展,或者,

  1. Install Graphviz from https://graphviz.gitlab.io/_pages/Download/Download_windows.htmlhttps://graphviz.gitlab.io/_pages/Download/Download_windows.html安装 Graphviz
  2. Add C:\\Program Files (x86)\\Graphviz2.38\\bin (or your_installation_path/ bin) to your system variable PATHC:\\Program Files (x86)\\Graphviz2.38\\bin (或 your_installation_path/bin)添加到系统变量 PATH
  3. Open cmd and go to the dir where you saved the .dot file打开 cmd 并转到您保存 .dot 文件的目录
  4. Use the command dot music-recommender.dot -Tpng -o image.png使用命令dot music-recommender.dot -Tpng -o image.png

在此处输入图片说明

there is no requirement of any conversion.不需要任何转换。

We can simply use xdot command 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

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

You can use a very good online tool for it.您可以使用一个非常好的在线工具。 Here is the link dreampuf.github.io Just replace the code inside editer with your code.这是链接dreampuf.github.io只需将编辑器中的代码替换为您的代码即可。

$ dot -T pdf filename.dot > filename.pdf This works on my Windows 10. $ dot -T pdf filename.dot > filename.pdf 这适用于我的 Windows 10。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM