【发布时间】:2018-10-02 02:50:57
【问题描述】:
在我正在设计的这个 GUI 中找不到将我的 matplotlib 图嵌入到 QGraphicsView 对象的方法。我应该尝试将绘图转换为 PIL 图像还是有办法直接嵌入 matplotlib 图?
【问题讨论】:
标签: python matplotlib python-imaging-library qt-designer
在我正在设计的这个 GUI 中找不到将我的 matplotlib 图嵌入到 QGraphicsView 对象的方法。我应该尝试将绘图转换为 PIL 图像还是有办法直接嵌入 matplotlib 图?
【问题讨论】:
标签: python matplotlib python-imaging-library qt-designer
我不太明白您的问题,如果您想在 qt 图形上显示图像,请先尝试使用以下函数保存它。
plt.savefig('image1.png', transparent = True, bbox_inches = 'tight', pad_inches = 0)
然后您可以使用像素图并设置场景以显示在图形视图上。
【讨论】: