matplotlib plot 绘图函数发生阻塞(block)时的解决方法
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()