如何在 Mac 上使用 Python 中的点自动绘制图表?

发布于 2024-07-21 22:39:25 字数 1195 浏览 4 评论 0 原文

我正在 Python 程序中生成图表,现在我需要将它们可视化。

我使用 Tkinter 作为 GUI 来可视化所有其他数据,并且我希望在内部有一个带有数据图表的小子窗口。 目前,我的数据以 .dot 文件形式表示。 然后我保持 graphviz 打开,它会显示图表。 但这当然不是最理想的。 我需要在 tk 窗口内获取图表。

我考虑过从命令行使用 graphviz,但我总是遇到同样众所周知的错误:

Desktop ibook$ dot -Tpng -O 1.dot
dyld: lazy symbol binding failed: Symbol not found: _pixman_image_create_bits
  Referenced from: /usr/local/lib/graphviz/libgvplugin_pango.5.dylib
  Expected in: flat namespace

dyld: Symbol not found: _pixman_image_create_bits
  Referenced from: /usr/local/lib/graphviz/libgvplugin_pango.5.dylib
  Expected in: flat namespace

Trace/BPT trap

该错误似乎在 Graphviz 社区中众所周知:

http://www.graphviz.org/bugs/b1479.html

http://www.graphviz.org/bugs/b1488.html

http://www.graphviz.org/bugs/b1498.html

因此,既然我似乎无法使用命令行实用程序,我想知道是否有人知道绘制点图的直接方法在Python中,不使用命令行,或者做一些会引发相同错误的事情?

我正在 Mac Leopard 上编程,python 2.5.2

I am producing graphs in a Python program, and now I need to visualize them.

I am using Tkinter as GUI to visualize all the other data, and I would like to have a small subwindow inside with the graph of the data.
At the moment I have the data being represented in a .dot file. And then I keep graphviz open, which shows the graph. But this is of course suboptimal. I need to get the graph inside the tk window.

I thought about using graphviz from the command line, but I always run into the same well known bug:

Desktop ibook$ dot -Tpng -O 1.dot
dyld: lazy symbol binding failed: Symbol not found: _pixman_image_create_bits
  Referenced from: /usr/local/lib/graphviz/libgvplugin_pango.5.dylib
  Expected in: flat namespace

dyld: Symbol not found: _pixman_image_create_bits
  Referenced from: /usr/local/lib/graphviz/libgvplugin_pango.5.dylib
  Expected in: flat namespace

Trace/BPT trap

The bug seem to be well known in the Graphviz community:

http://www.graphviz.org/bugs/b1479.html

http://www.graphviz.org/bugs/b1488.html

http://www.graphviz.org/bugs/b1498.html

So since it seems that I cannot use the command line utility I was wondering if anyone knew a direct way to draw a dot graph in Python, without using the command line, or doing something that would incur the same error?

I am programming on a Mac Leopard, python 2.5.2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

沉默的熊 2024-07-28 22:39:25

我没有 Mac 来测试它,但是 NetworkX 包包含 读取 .dot 文件使用 >matplotlib。 您可以在 Tk 中嵌入 matplotlib 图形(示例 1示例2)。

I do not have a mac to test it on, but the NetworkX package includes methods to read .dot files and draw graphs using matplotlib. You can embed a matplotlib figure in Tk (example 1, example 2).

菊凝晚露 2024-07-28 22:39:25

快速Google 调出http://code.google.com/p/pydot/。 我还没有尝试过,但看起来很有希望。

Quick Google pulls up http://code.google.com/p/pydot/. I haven't tried it but it looks promising.

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