Matplotlib绘图到QtGraphicsView

时间:2018-04-21 16:08:54

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

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

1 个答案:

答案 0 :(得分:1)

我真的不明白你的问题,如果你试图在qt图形上显示图像,首先尝试使用以下功能保存它。

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

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