'Complete the plot: add tools.'

def close_figure(self, fig):

    (tool_objs, tools_map) = _process_tools_arg(self.plot, self.tools)
    self.plot.add_tools(*tool_objs)
    if (len(fig.axes) <= 1):
        self.fig = self.plot
        self.plot.renderers.sort(key=(lambda x: self.zorder.get(x._id, 0)))
    else:
        subrends = []
        for i in range(1, len(self._axes)):
            (start, end) = (self._axes[(i - 1)], self._axes[i])
            subrends += [self.plot.renderers[start:end]]
        plots = []
        for (i, axes) in enumerate(fig.axes):
            _plot = Plot(x_range=self.plot.x_range, y_range=self.plot.y_range, plot_width=self.width, plot_height=self.height)
            _plot.title.text = ''
            (_tool_objs, _tool_map) = _process_tools_arg(_plot, DEFAULT_TOOLS)
            _plot.add_tools(*_tool_objs)
            _plot_rends = subrends[i]
            for r in _plot_rends:
                if (not isinstance(r, GlyphRenderer)):
                    r.plot = None
            for r in _plot_rends:
                if isinstance(r, GlyphRenderer):
                    _plot.renderers.append(r)
                elif isinstance(r, Grid):
                    _plot.add_layout(r)
                elif (r in self.plot.below):
                    _plot.add_layout(r, 'below')
                elif (r in self.plot.above):
                    _plot.add_layout(r, 'above')
                elif (r in self.plot.left):
                    _plot.add_layout(r, 'left')
                elif (r in self.plot.right):
                    _plot.add_layout(r, 'right')
            _plot.renderers.sort(key=(lambda x: self.zorder.get(x._id, 0)))
            plots.append(_plot)
        (a, b, c) = fig.axes[0].get_geometry()
        p = np.array(plots)
        n = np.resize(p, (a, b))
        grid = gridplot(n.tolist())
        self.fig = grid
