Graphviz:如何从 .dot 到图表?

发布于 2024-08-06 18:46:34 字数 100 浏览 6 评论 0原文

我似乎无法弄清楚这一点。我有一个 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

忘年祭陌 2024-08-13 18:46:34

请输入

dot -Tps filename.dot -o outfile.ps

如果您想使用 dot 渲染器, 。还有一些替代方案,例如 neatotwopi.如果 Graphviz 不在您的路径中,请找出它的安装位置并从那里运行它。

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

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

请访问 Graphviz 网站,了解有关如何使用这些工具的更多详细信息:https://www.graphviz.org /documentation/

有关 dot 命令的输出格式,请参阅“命令行选项”部分,例如: https://www.graphviz.org/pdf/dotguide.pdf

Type

dot -Tps filename.dot -o outfile.ps

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

指尖上的星空 2024-08-13 18:46:34
dot -Tps input.dot > output.eps
dot -Tpng input.dot > output.png

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

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.

还在原地等你 2024-08-13 18:46:34

点文件.dot -Tpng -o image.png

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

dot file.dot -Tpng -o image.png

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

一影成城 2024-08-13 18:46:34

获取 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.

高跟鞋的旋律 2024-08-13 18:46:34

这应该结合很多答案。

# 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

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

brew install graphviz

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

conda install python-graphviz

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.

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.

conda install python-graphviz
梦情居士 2024-08-13 18:46:34

您可以使用 VS 代码并安装 Graphviz 扩展,或者

  1. 从以下位置安装 Graphviz
    https://graphviz.gitlab.io/_pages/Download/Download_windows.html
  2. C:\Program Files (x86)\Graphviz2.38\bin (或 your_installation_path/ bin)添加到系统变量中
    PATH
  3. 打开 cmd 并转到保存 .dot 文件的目录
  4. 使用命令 dot music-recommender.dot -Tpng -o image.png

在此处输入图像描述

You can use the VS code and install the Graphviz extension or,

  1. Install Graphviz from
    https://graphviz.gitlab.io/_pages/Download/Download_windows.html
  2. Add C:\Program Files (x86)\Graphviz2.38\bin (or your_installation_path/ bin) to your system variable
    PATH
  3. Open cmd and go to the dir where you saved the .dot file
  4. Use the command dot music-recommender.dot -Tpng -o image.png

enter image description here

碍人泪离人颜 2024-08-13 18:46:34

您还可以以 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.

脸赞 2024-08-13 18:46:34

没有任何转换的要求。

我们可以简单地在 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

小苏打饼 2024-08-13 18:46:34

$ dot -T pdf 文件名.dot >文件名.pdf
这适用于我的 Windows 10。

$ dot -T pdf filename.dot > filename.pdf
This works on my Windows 10.

冰之心 2024-08-13 18:46:34

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

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

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

For window user, Please run complete command to convert *.dot file to 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

寻找我们的幸福 2024-08-13 18:46:34

您可以使用一个非常好的在线工具来完成它。这是链接
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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文