How to show two figures using matplotlib?

后端 未结 4 568
甜味超标
甜味超标 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:42

    Alternatively to calling plt.show() at the end of the script, you can also control each figure separately doing:

    f = plt.figure(1)
    plt.hist........
    ............
    f.show()
    
    g = plt.figure(2)
    plt.hist(........
    ................
    g.show()
    
    raw_input()
    

    In this case you must call raw_input to keep the figures alive. This way you can select dynamically which figures you want to show

    Note: raw_input() was renamed to input() in Python 3

提交回复
热议问题