def make_axes_from_grid(fig, gs):
    """Generate 2D array of subplot axes from a gridspec

    Args:
     - fig(matplotlib.figure.Figure): a matplotlib figure handle
     - gs(matplotlib.gridspec.GridSpec): the gridspec

    Returns:
     - list of lists (2D array) of subplot axes
    """
    axes = []
    (rows, cols) = gs.get_geometry()
    for row in range(rows):
        axes.append([])
        for col in range(cols):
            axes[-1].append(fig.add_subplot(gs[row, col]))
    return axes