So I am trying to make the curve moves as shown in the link, I have thought about moving limits each time but the graph is still static. I have tried before that its starts plot and pause but it wasn't like as shown smooth. 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()
There are some things missing or on the wrong place in the example above. Compare it with the code on the bottom.
Here some explanations:
added [-1:] because you dont want to recalculate your entire plot for every step
Put your xlim inside your if loop and set the xlim to the range you want to see:
This is how it looks for your example: