Is there a way to detach matplotlib plots so that the computation can continue?

  • 在一般编辑器中:

    from matplotlib.pyplot import plot, draw, show
    plot([1,2,3])
    draw()
    print 'continue computation'
    
    
    # at the end call show to ensure window won't close.
    
    show()
  • 在交互(interactive)模式下(比如 IPython):

    from matplotlib.pyplot import plot, ion, show
    ion() # enables interactive mode
    plot([1,2,3]) # result shows immediatelly (implicit draw())
    
    print 'continue computation'
    
    
    # at the end call show to ensure window won't close.
    
    show()
posted on 2017-03-20 17:10  未雨愁眸  阅读(203)  评论(0编辑  收藏  举报