감동, 마음이 움직이는 것

[python] plot during simulation 본문

Tips (Utility, Computer Language, and etc.)

[python] plot during simulation

Struggler J. 2018. 12. 4. 20:25

[ref]

https://stackoverflow.com/questions/11874767/how-do-i-plot-in-real-time-in-a-while-loop-using-matplotlib

https://stackoverflow.com/questions/23141452/difference-between-plt-draw-and-plt-show-in-matplotlib


# main loop

for t in range(10000):

    bk += dt*eom(temp_bk)  

    t += dt

   

    #plot

    if time%1000==0:

        plt.axis([100, 300, 0, 0.2])

        plt.plot(bk)

        plt.pause(0.05)

    

plt.show()