Use imshow of matplotlib.pylab with a python ide?(将 matplotlib.pylab 的 imshow 与 python ide 一起使用?)
问题描述
我尝试在 photutil 中运行示例/p>
一切都很好,除了这条线
plt.imshow(image, cmap='gray_r', origin='lower')
不会引发异常但不显示图像.我用的是 eric ide.
之后需要调用plt.show()
.
来自 Matplotlib 常见问题解答:
<块引用>当您想在显示器上查看绘图时,用户界面后端需要启动 GUI 主循环.这就是 show() 所做的.它告诉 matplotlib 提升到目前为止创建的所有图形窗口并启动主循环.因为这个主循环默认是阻塞的(即脚本执行被暂停),你应该只在每个脚本最后调用一次.关闭最后一个窗口后恢复脚本执行.
I tried to run example in photutil
Everything works great except the line
plt.imshow(image, cmap='gray_r', origin='lower')
which does not raise an exception but no image is shown. I use the eric ide.
You need to call plt.show()
afterwards.
From the Matplotlib FAQ:
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 的 imshow 与 python ide 一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 matplotlib.pylab 的 imshow 与 python ide 一起使用?


- 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
- 我如何透明地重定向一个Python导入? 2022-01-01
- ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
- CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01
- 计算测试数量的Python单元测试 2022-01-01
- 我如何卸载 PyTorch? 2022-01-01
- 如何使用PYSPARK从Spark获得批次行 2022-01-01
- YouTube API v3 返回截断的观看记录 2022-01-01
- 使用 Cython 将 Python 链接到共享库 2022-01-01
- 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01