'Exit "raster" mode.  All of the drawing that was done since
the last start_rasterizing command will be copied to the
vector backend by calling draw_image.
If stop_rasterizing is called multiple times before
start_rasterizing is called, this method has no effect.'

def stop_rasterizing(self):

    self._rasterizing -= 1
    if (self._rasterizing == 0):
        self._set_current_renderer(self._vector_renderer)
        height = (self._height * self.dpi)
        (buffer, bounds) = self._raster_renderer.tostring_rgba_minimized()
        (l, b, w, h) = bounds
        if ((w > 0) and (h > 0)):
            image = np.frombuffer(buffer, dtype=np.uint8)
            image = image.reshape((h, w, 4))
            image = image[::(-1)]
            gc = self._renderer.new_gc()
            self._renderer.draw_image(gc, ((float(l) / self.dpi) * self._figdpi), ((((float(height) - b) - h) / self.dpi) * self._figdpi), image)
        self._raster_renderer = None
        self._rasterizing = False
        self.figure.set_dpi(self._figdpi)
    if self._bbox_inches_restore:
        r = process_figure_for_rasterizing(self.figure, self._bbox_inches_restore, self._figdpi)
        self._bbox_inches_restore = r
