How to update a plot in matplotlib?

后端 未结 7 1763
不思量自难忘°
不思量自难忘° 2020-11-22 02:11

I\'m having issues with redrawing the figure here. I allow the user to specify the units in the time scale (x-axis) and then I recalculate and call this function plots

7条回答
  •  死守一世寂寞
    2020-11-22 03:09

    You can also do like the following: This will draw a 10x1 random matrix data on the plot for 50 cycles of the for loop.

    import matplotlib.pyplot as plt
    import numpy as np
    
    plt.ion()
    for i in range(50):
        y = np.random.random([10,1])
        plt.plot(y)
        plt.draw()
        plt.pause(0.0001)
        plt.clf()
    

提交回复
热议问题