使用图像显示matplotlib.pylab使用python ide?

2024-09-30 14:34:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在photutil中运行示例

除了台词,一切都很好

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

这不会引发异常,但不会显示图像。我使用eric ide。在


Tags: 图像image示例pltoriginidelowercmap
2条回答
# need to use matplotlib inline if want to show at jupyter Notebook
%matplotlib inline
plt.imshow(image, cmap='gray_r', origin='lower')
plt.show()

您需要稍后致电plt.show()。在

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.

相关问题 更多 >