Graphviz:如何从 .dot 到图表?
我似乎无法弄清楚这一点。我有一个 .dot 文件,根据语法该文件是有效的。如何使用 Graphviz 将其转换为图像?
(注意,我是在Windows上,不是Linux上)
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?
(Note that I'm on Windows, not Linux)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
请输入
如果您想使用 dot 渲染器, 。还有一些替代方案,例如 neato 和 twopi.如果 Graphviz 不在您的路径中,请找出它的安装位置并从那里运行它。
您可以通过改变
-T
后面的值来更改输出格式在-o
之后选择适当的文件扩展名。如果您使用的是 Windows,请查看已安装的名为 GVEdit 的工具,它使整个过程稍微容易一些。
请访问 Graphviz 网站,了解有关如何使用这些工具的更多详细信息:https://www.graphviz.org /documentation/
有关 dot 命令的输出格式,请参阅“命令行选项”部分,例如: https://www.graphviz.org/pdf/dotguide.pdf
Type
if you want to use the dot renderer. There are alternatives like neato and twopi. If Graphviz isn't in your path, figure out where it is installed and run it from there.
You can change the output format by varying the value after
-T
and choosing an appropriate filename extension after-o
.If you're using Windows, check out the installed tool called GVEdit, it makes the whole process slightly easier.
Go look at the Graphviz site for more details on how to use the tools: https://www.graphviz.org/documentation/
See section "Command Line Options" for output formatting for the dot command, for instance: https://www.graphviz.org/pdf/dotguide.pdf
PostScript 输出似乎总是存在。我不确定 dot 默认是否有 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.
这适用于 Windows 和 Linux。必须安装 Graphviz。
This works on Windows and Linux. Graphviz must be installed.
还有在线查看器:
There are also the online viewers:
获取 graphviz-2.24.msi Graphviz.org。然后获取zgrviewer。
Zgrviewer 需要 java(可能是 1.5+)。您可能必须在 Zgrviewer 的首选项中设置 Graphviz 二进制文件的路径。
文件->打开->用点打开 -> SVG 管道(标准)...
选择您的 .dot 文件。
你可以放大,导出,各种有趣的东西。
Get the graphviz-2.24.msi Graphviz.org. Then get zgrviewer.
Zgrviewer requires java (probably 1.5+). You might have to set the paths to the Graphviz binaries in Zgrviewer's preferences.
File -> Open -> Open with dot -> SVG pipeline (standard) ...
Pick your .dot file.
You can zoom in, export, all kinds of fun stuff.
这应该结合很多答案。
请记住,在 OSX (MAC) 上,您需要安装 homebrew 来安装 graphviz 才能使用上面的点命令。
如果您安装了 Anaconda,还可以通过 conda 的包管理器功能安装 Graphviz(并使用上面的命令)。
This should combine a lot of answers.
Keep in mind that on OSX (MAC), you need to install homebrew to install graphviz to be able to use the dot commands above.
It is also possible to install Graphviz (and use the commands above) through the package manager functionality of conda if you have Anaconda installed.
您可以使用 VS 代码并安装 Graphviz 扩展,或者
https://graphviz.gitlab.io/_pages/Download/Download_windows.html
C:\Program Files (x86)\Graphviz2.38\bin
(或 your_installation_path/ bin)添加到系统变量中PATH
dot music-recommender.dot -Tpng -o image.png
You can use the VS code and install the Graphviz extension or,
https://graphviz.gitlab.io/_pages/Download/Download_windows.html
C:\Program Files (x86)\Graphviz2.38\bin
(or your_installation_path/ bin) to your system variablePATH
dot music-recommender.dot -Tpng -o image.png
您还可以以 xdot 格式输出文件,然后使用 JavaScript 库 canviz 在浏览器中呈现它。
code.google.com 上的 Canviz:
要查看示例,请参阅“Canviz 演示”截至 2014 年 11 月 2 日,上述页面上的链接。
You can also output your file in xdot format, then render it in a browser using canviz, a JavaScript library.
Canviz on code.google.com:
To see an example, there is a "Canviz Demo" link on the page above as of November 2, 2014.
没有任何转换的要求。
我们可以简单地在 Linux 中使用 xdot 命令,它是 Graphviz 点文件的交互式查看器。
例如:xdot file.dot
了解更多信息:https://github.com/rakhimov/cppdep/wiki/How-to-view-or-work-with-Graphviz-Dot-files
there is no requirement of any conversion.
We can simply use xdot command in Linux which is an Interactive viewer for Graphviz dot files.
ex: xdot file.dot
for more infor:https://github.com/rakhimov/cppdep/wiki/How-to-view-or-work-with-Graphviz-Dot-files
$ dot -T pdf 文件名.dot >文件名.pdf
这适用于我的 Windows 10。
$ dot -T pdf filename.dot > filename.pdf
This works on my Windows 10.
对于 Windows 用户,请运行完整的命令将 *.dot 文件转换为 png:
我在 solgraph 中发现了一个错误,它正在利用旧版本的 Solidity-parser,该解析器似乎不够智能,无法捕获为 Solidity 编程所做的新增强功能语言本身,例如发出事件的关键字
For window user, Please run complete command to convert *.dot file to 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
您可以使用一个非常好的在线工具来完成它。这是链接
dreampuf.github.io
只需将编辑器中的代码替换为您的代码即可。
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.