【问题标题】:How can you display Matplotlib objects in a GUI using qtdesigner?如何使用 qtdesigner 在 GUI 中显示 Matplotlib 对象?
【发布时间】:2018-06-22 11:23:46
【问题描述】:

我试图将 matplotlib 图形集成到 qt 设计器中设计的 GUI 中,但未能正确集成两者。

我将如何将 QGraphicsView 对象提升/更改/ect 到可以显示 matplotlib 生成的图形的画布中? This Example 确切地讨论了我正在努力解决的问题,但使用 matplotlibwidget 进行引用,这在我的 Qtdesigner 版本中不存在?

我已经看到了从头开始围绕 matplotlib 画布设计 qtapplication 窗口的方法,但无法采用 qtdesigner 构建的 gui 并实现 matplotlib,因为使用设计器时,对象以更复杂的方式集成。

【问题讨论】:

  • 您的问题是什么?在 SO 中,每个帖子你应该只问一个问题,所以按钮显示 ask question,而不是 ask questions
  • 这个问题读起来很混乱。首先,pyqtgraph 和 matplotlib 或 seaborn 无关。所以你需要决定是要使用 pyqtgraph 还是 matplotlib/seaborn。与 QGraphicsView 相同 - 这是一个 PyQt 对象,不能放入 matplotlib 图形中。如果问题是如何将 matplotlib 画布集成到 PyQt 窗口中,那么围绕 SO 有很多问题。您需要使用这些示例中的任何一个来准确说​​明您遇到了什么问题。

标签: python matplotlib pyqt5 heatmap pyqtgraph


【解决方案1】:

我试图重现您关于the example 的问题,实际上,当我运行corresponding code from GitHub 时,我得到了错误:

ImportError: No module named 'matplotlibwidget'

问题在于MatplotLibWidget 是 WinPython 发行版的一部分,因此只有在您使用 WinPython 时才可用。

我找到了MatplotlibWidgethere的源代码。为了使示例正常工作,请将其放在与示例代码相同的目录中名为 matplotlibwidget.py 的文件中。

编辑:我创建了一个关于它的问题here

【讨论】:

    猜你喜欢
    • 2018-06-14
    • 1970-01-01
    • 2015-03-21
    • 2014-01-24
    • 1970-01-01
    • 1970-01-01
    • 2019-09-27
    • 1970-01-01
    • 2018-07-15
    相关资源
    最近更新 更多