我已成功使用 pyplot 来显示热图。今天它似乎已经停止工作了。
我的问题是设置我的绘图,然后调用该show()方法在窗口中显示该图形,但是当我关闭该窗口(通过单击顶部的 x)时,我的代码不会继续经过show()调用该方法的位置。看来要坚持下去了show()。
matrix是一个numpy矩阵。
这是我的代码的示例:
plt.pcolor(matrix, cmap=plt.cm.binary)
plt.xlabel('xaxis', fontsize=20)
plt.ylabel('yaxis', fontsize=20)
plt.axis([0, matrix.shape[1], 0, matrix.shape[0]])
plt.colorbar()
#This is where my code hangs...
plt.show()
#Closing the window manually does nothing.
#And the close() method doesn't seem to do anything.
plt.close()
Run Code Online (Sandbox Code Playgroud)
show()调用该方法并关闭窗口后,我的进程继续运行,我必须手动终止它。
有谁知道发生这种情况的原因?
| 归档时间: |
|
| 查看次数: |
3839 次 |
| 最近记录: |