docs: def dynamic_zoom_plot(x, y, N, RegionStartSize=1000):
      """
      plots 2 time traces, the top is the downsampled time trace
      the bottom is the full time trace.
  
      
      """
      x_lowres = x[::N]
      y_lowres = y[::N]
      
      ax1 = _plt.subplot2grid((2, 1), (0, 0), colspan=1)
      ax2 = _plt.subplot2grid((2, 1), (1, 0))
      
      fig = ax1.get_figure()
      _plt.subplots_adjust(bottom=0.25) # makes space at bottom for sliders
      
      CenterTime0 = len(x)/2
      TimeWidth0 = len(x)/RegionStartSize
      
      l1, = ax1.plot(x_lowres, y_lowres, lw=2, color='red')
      global r1
      r1 = ax1.fill_between(x_lowres[int((CenterTime0 - TimeWidth0)/N) : int((CenterTime0 + TimeWidth0)/N)], min(y), max(y), facecolor='green', alpha=0.5)
      l2, = ax2.plot(x, y, lw=2, color='red')
      
      
      axcolor = 'lightgoldenrodyellow'
      axCenterTime = _plt.axes([0.25, 0.1, 0.65, 0.03], facecolor=axcolor)
      axTimeWidth = _plt.axes([0.25, 0.15, 0.65, 0.03], facecolor=axcolor)
      
      SliderCentreTime = Slider(axCenterTime, 'Center Time', 0, len(x), valinit=CenterTime0)
      SliderTimeWidth = Slider(axTimeWidth, 'Time Width', 0, len(x), valinit=TimeWidth0)
      
      
      def update(val):
          TimeWidth = SliderTimeWidth.val
          CentreTime = SliderCentreTime.val
          LeftIndex = int(CentreTime-TimeWidth)
          if LeftIndex < 0:
              LeftIndex = 0
          RightIndex = int(CentreTime+TimeWidth)
          if RightIndex > len(x)-1:
              RightIndex = len(x)-1
          global r1
          r1.remove()
          r1 = ax1.fill_between(x[LeftIndex:RightIndex], min(y), max(y), facecolor='green', alpha=0.5)
          l2.set_xdata(x[LeftIndex:RightIndex])
          l2.set_ydata(y[LeftIndex:RightIndex])
          ax2.set_xlim([x[LeftIndex], x[RightIndex]])
          fig.canvas.draw_idle()
      SliderCentreTime.on_changed(update)
      SliderTimeWidth.on_changed(update)
      
      resetax = _plt.axes([0.8, 0.025, 0.1, 0.04])
      button = Button(resetax, 'Reset', color=axcolor, hovercolor='0.975')
      
      
      def reset(event):
          SliderCentreTime.reset()
          SliderTimeWidth.reset()
      button.on_clicked(reset)    
      
      _plt.show()