def main(): x, y = make_noise_sin_wave(10, 10000) ax = pl.subplot(111) x, y = make_noise_sin_wave(20, 100000) line, = pl.plot(*get_peaks(x, y, 500)) ax = pl.gca() def update_data(ax): x0, x1 = ax.get_xlim() line.set_data(*get_peaks(x, y, 500, x0, x1)) ax.figure.canvas.draw_idle() ax.callbacks.connect('xlim_changed', update_data) pl.show()
def update_data(ax): x0, x1 = ax.get_xlim() line.set_data(*get_peaks(x, y, 500, x0, x1)) ax.figure.canvas.draw_idle()