Use imshow of matplotlib.pylab with a python ide?

前端 未结 2 1609
小鲜肉
小鲜肉 2020-12-06 23:34

I tried to run example in photutil

Everything works great except the line

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

whi

相关标签:
2条回答
  • 2020-12-07 00:09

    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.

    0 讨论(0)
  • 2020-12-07 00:11
    # need to use matplotlib inline if want to show at jupyter Notebook
    %matplotlib inline
    plt.imshow(image, cmap='gray_r', origin='lower')
    plt.show()
    
    0 讨论(0)
提交回复
热议问题