Set_ylim usage/features

It looks like you are already using the event system ( and widgets ( to implement the < and > buttons .

From python you have access to the current view limits of the axes (ax.get_xlim()). If you also have access to the original data you passed in you can then use that to extract the current view range to do what ever you want with. You can extract the data back from the Line2D objects created by ax.plot, but it is more reliable to do your own book keeping of the data.

In particular you may find the matplotlib.widgets.SpanSelector useful here (