【问题标题】:Matplotlib plot to QtGraphicsViewMatplotlib 绘制到 QtGraphicsView
【发布时间】:2018-10-02 02:50:57
【问题描述】:

在我正在设计的这个 GUI 中找不到将我的 matplotlib 图嵌入到 QGraphicsView 对象的方法。我应该尝试将绘图转换为 PIL 图像还是有办法直接嵌入 matplotlib 图?

【问题讨论】:

    标签: python matplotlib python-imaging-library qt-designer


    【解决方案1】:

    我不太明白您的问题,如果您想在 qt 图形上显示图像,请先尝试使用以下函数保存它。

    plt.savefig('image1.png', transparent = True, bbox_inches = 'tight', pad_inches = 0)
    

    然后您可以使用像素图并设置场景以显示在图形视图上。

    【讨论】:

      猜你喜欢
      • 2019-05-22
      • 2015-08-19
      • 1970-01-01
      • 1970-01-01
      • 2013-06-09
      • 2017-09-03
      • 1970-01-01
      • 1970-01-01
      • 2012-10-08
      相关资源
      最近更新 更多