I have a long data sequence to plot, and am trying to pan along the x axis programmatically.
fig_raw = plt.figure(num = 'raw');
plt.plot(data_rd, figure=fig_raw);
plt.xlim(0, 200);
plt.show(False);
for i in range(0, data_rd.size/200-1):
plt.xlim(i*200, (i+1)*200);
time.sleep(1)
But this code does not pan through the x axis. It shows the first xlimits and the final xlimits in x axis. I have tried adding plt.draw()
after each call to xlim
, but the behaviour is the same. If I add raw_input('any text')
after each xlim
, the figure's x axis limits are updated.
What works:
fig_raw = plt.figure(num = 'raw');
plt.plot(data_rd, figure=fig_raw);
plt.xlim(0, 200);
plt.show(False);
for i in range(0, data_rd.size/200-1):
plt.xlim(i*200, (i+1)*200);
plt.draw();
raw_input(i);
time.sleep(1);
How can I do programmatic pan (without using raw_input()
)?