将pyqt嵌入到matplotlib中

时间:2015-04-21 15:32:18

标签: python matplotlib pyqt4 pycharm

我有这个在matplotlib图中显示3d线的python代码。 我使用plt.show()来显示数字。 但是我希望显示由' pyQt'创建的图形内部形式。 表单包括" Widget"和" pushButton" ,当我点击按钮时,我想在小部件内显示三维图形。我怎样才能做到这一点 ?

代码:

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x, y, z = [1, 2, 3, 4, 5, 6, 7, 3, 2, 1, 4], [6, 5, 3, 2, 1, 2, 4, 5, 6, 100, 6], [6, 5, 3, 2, 5, 5, 7, 8, 6, 3, 1]
ax.plot_wireframe(x, y, z)
plt.show()

这是表格图片: Form

1 个答案:

答案 0 :(得分:1)

您可能需要查看文档:

http://matplotlib.org/examples/user_interfaces/embedding_in_qt4.html

也许还有例子:

http://www.technicaljar.com/?p=688

http://eli.thegreenplace.net/2009/01/20/matplotlib-with-pyqt-guis/

搜索pyqt和matplotlib应该会给出一些有趣的结果。