Matplotlib pyplot show() doesn't work once closed

前端 未结 4 839
迷失自我
迷失自我 2020-12-31 20:06

I have a loop like this

#!/usr/bin/env python
import matplotlib.pyplot as p

for i in xrange(N):
    # Create my_image here

    # Display this image
    p.fi         


        
4条回答
  •  死守一世寂寞
    2020-12-31 20:47

    I have long been looking into this problem and I may have a solution although I haven't thoroughly tested it yet.

    The key is in writing code more like MatLab, name your figures and then call them to show().

    eg.

     from matplotlib import pyplot as plt
    
     fig1 = plt.figure()
     fig2 = plt.figure()
    
     fig1.show()
     fig2.show()
    

    This might work for animations and plotting at different stages

提交回复
热议问题