if e.key == 'right':
    curr_pos = curr_pos + 1
elif e.key == 'left':
    curr_pos = curr_pos - 1
else:
    return
curr_pos = curr_pos % len(plots)
ax.cla()
ax.plot(plots[curr_pos][0], plots[curr_pos][1])
fig.canvas.draw()
fig = plt.figure()
fig.canvas.mpl_connect('key_press_event', key_event)
ax = fig.add_subplot(111)
ax.plot(t, y1)
plt.show()
Scroll backwards and forwards through matplotlib plots