def __init__(self, fig, page_step=1):
        """Make a scrolling x axis on figure `fig`.
        `page_step` is the multiplier for page-step scrolling.
        """
        # Setup data range variables for scrolling
        self.fig = fig
        self.page_step = page_step # configurable for page step
        self.xmin, self.xmax = fig.axes[0].get_xlim()
        self.width = min(1, self.xmax-self.xmin) # axis units
        self.pos = 0   # axis units
        self.scale = 1e3 # conversion between scrolling units and axis units
        
        # Some handy shortcuts
        self.ax = self.fig.axes[0]
        self.draw = self.fig.canvas.draw
        #self.draw_idle = self.fig.canvas.draw_idle

        # Retrive the QMainWindow used by current figure and add a toolbar
        # to host the new widgets
        QMainWin = fig.canvas.parent()
        toolbar = QtGui.QToolBar(QMainWin)
        QMainWin.addToolBar(QtCore.Qt.BottomToolBarArea, toolbar)
        
        # Create the slider and spinbox for x-axis scrolling in toolbar
        self.set_slider(toolbar)
        self.set_spinbox(toolbar)
        
        # Set the initial xlimits coherently with values in slider and spinbox
        self.ax.set_xlim(self.pos,self.pos+self.width)
        self.draw()
def __init__ ( self , fig , page_step = 1 ) : self . fig = fig self . page_step = page_step self . xmin , self . xmax = fig . axes [ 0 ] . get_xlim ( ) self . width = min ( 1 , self . xmax - self . xmin ) self . pos = 0 self . scale = 1e3 self . ax = self . fig . axes [ 0 ] self . draw = self . fig . canvas . draw QMainWin = fig . canvas . parent ( ) toolbar = QtGui . QToolBar ( QMainWin ) QMainWin . addToolBar ( QtCore . Qt . BottomToolBarArea , toolbar ) self . set_slider ( toolbar ) self . set_spinbox ( toolbar ) self . ax . set_xlim ( self . pos , self . pos + self . width ) self . draw ( )
Make a scrolling x axis on figure `fig`.
        `page_step` is the multiplier for page-step scrolling.