def draw(self, context):
rect = self.get_allocation()
self._surface = cairo.ImageSurface(cairo.FORMAT_ARGB32,
rect.width, rect.height)
self.plot()
context.set_source_surface(self._surface, 0, 0)
context.paint()