使用matplotlib.pylab与python ide的imshow? [英] Use imshow of matplotlib.pylab with a python ide?

查看:165
本文介绍了使用matplotlib.pylab与python ide的imshow?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 photutil 中运行示例

一切都很好,除了行

plt.imshow(image, cmap='gray_r', origin='lower')

不会引发异常但没有图像显示。我使用eric ide。

which does not raise an exception but no image is shown. I use the eric ide.

推荐答案

你需要调用 plt.show()之后。

来自 Matplotlib常见问题解答


当您想在显示器上查看图表时,用户界面后端需要启动GUI主界面。这就是 show()的作用。它告诉matplotlib提升到目前为止创建的所有数字窗口并启动mainloop。因为默认情况下此主循环是阻塞的(即,脚本执行暂停),所以最后每个脚本只应调用一次。最后一个窗口关闭后,脚本执行将恢复。

When you want to view your plots on your display, the user interface backend will need to start the GUI mainloop. This is what show() does. It tells matplotlib to raise all of the figure windows created so far and start the mainloop. Because this mainloop is blocking by default (i.e., script execution is paused), you should only call this once per script, at the end. Script execution is resumed after the last window is closed.

这篇关于使用matplotlib.pylab与python ide的imshow?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆