def clean_grid(fig, axs):
    """Clean up a grid of axes by removing unused axes."""
    for ax in axs.ravel():
        if not (len(ax.images) or len(ax.lines) or len(ax.patches)):
            fig.delaxes(ax)
    return fig, axs