class MplCanvas(FigureCanvas): """Class to represent the FigureCanvas widget""" def __init__(self): # setup Matplotlib Figure and Axis self.fig = Figure() self.ax = self.fig.add_subplot(111) self.ax.grid() self.fig.set_animated(True) #maxy = 500 #self.ax.set_ylim(-5, 5) #self.ax.set_xlim(-2, 0) #self.ax.set_ylabel('value') #self.ax.set_xlabel('time') # initialization of the canvas FigureCanvas.__init__(self, self.fig) # we define the widget as expandable FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) # notify the system of updated policy FigureCanvas.updateGeometry(self)