[英]Use imshow of matplotlib.pylab with a python ide?
You need to call plt.show()
afterwards. 之后,您需要调用
plt.show()
。
From the Matplotlib FAQ : 从Matplotlib常见问题解答 :
When you want to view your plots on your display, the user interface backend will need to start the GUI mainloop.
当您想在显示器上查看绘图时,用户界面后端将需要启动GUI主循环。 This is what show() does.
这就是show()所做的。 It tells matplotlib to raise all of the figure windows created so far and start the mainloop.
它告诉matplotlib提升到目前为止创建的所有图形窗口并启动mainloop。 Because this mainloop is blocking by default (ie, 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.
关闭最后一个窗口后,将继续执行脚本。
# need to use matplotlib inline if want to show at jupyter Notebook
%matplotlib inline
plt.imshow(image, cmap='gray_r', origin='lower')
plt.show()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.