Shifitng和移动曲线matplotlib

问题描述 投票:0回答:0

所以我试图让曲线如链接所示移动,我每次都考虑过移动限制,但图形仍然是静态的。我之前尝试过它开始绘制和暂停,但它并不像显示的那样流畅。 https://drive.google.com/file/d/1sBunkQT-8gB2ttCLAmoYQaniO-qUp6in/view

limit_values = [] 
limity_values = []

for value in data[1:]:
    
    
    x = float(value[0])
    y = float(value[1])
    limit_values.append(x)
    limity_values.append(y)


time_values=[]
amplitude_values=[]
counter_for_changing_limit=0
limits_changer_x=[]
limits_changer_y=[]

for value in data[1:]:
    x = float(value[0])
    y = float(value[1])
    time_values.append(x)
    amplitude_values.append(y)
    limits_changer_x.append(x)
    limits_changer_y.append(y)
    plt.xlim(min(limits_changer_x), max(limits_changer_x))
    plt.ylim(min(limity_values), max(limity_values))
    counter_for_changing_limit+=1
    # if(counter_for_changing_limit==20 or counter_for_changing_limit==40 or counter_for_changing_limit==60):
    #     plt.plot(time_values, amplitude_values, color='black',label="signal one")
    #     plt.pause(0.1)
    
    
    if(counter_for_changing_limit==60):
        counter_for_changing_limit=0
        del limits_changer_x[0:1]
        del limits_changer_y[0:1]
    plt.plot(limit_values, limity_values, color='black',label="signal one")
    
plt.title('Signal Viewer')  
plt.xlabel('Time (s)')  
plt.ylabel('Amplitude (m)')  
plt.show()
python matplotlib dynamic axes
© www.soinside.com 2019 - 2024. All rights reserved.