How to show two figures using matplotlib?

后端 未结 4 565
甜味超标
甜味超标 2020-11-29 18:02

I have some troubles while drawing two figures at the same time, not shown in a single plot. But according to the documentation, I wrote the code and only the figure one sho

4条回答
  •  清酒与你
    2020-11-29 18:44

    Alternatively, I would suggest turning interactive on in the beginning and at the very last plot, turn it off. All will show up, but they will not disappear as your program will stay around until you close the figures.

    import matplotlib.pyplot as plt
    from matplotlib import interactive
    
    plt.figure(1)
    ... code to make figure (1)
    
    interactive(True)
    plt.show()
    
    plt.figure(2)
    ... code to make figure (2)
    
    plt.show()
    
    plt.figure(3)
    ... code to make figure (3)
    
    interactive(False)
    plt.show()
    

提交回复
热议问题