Set_ylim usage/features

It looks like you are already using the event system (https://matplotlib.org/3.2.1/users/event_handling.html) and widgets (https://matplotlib.org/3.2.1/api/widgets_api.html?highlight=widgets#module-matplotlib.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 (https://matplotlib.org/3.2.1/api/widgets_api.html#matplotlib.widgets.SpanSelector)