def turn_off_empty_axes(n_plots_y, n_plots_x, ax):
    """ Turns off empty axes in a `n_plots_y` by `n_plots_x` grid of plots.

    Args:
      n_plots_y (int) : See above.
      n_plots_x (int) : See above.
      ax (matplotlib.axes) : Matplotlib object containing grid of plots.
    """
    for vi in range(n_plots_y):
        for vj in range(n_plots_x):
            # if nothing plotted on ax, it will contain `inf`
            # in axes lims, so clean up (turn off)
            if "inf" in str(ax[vi, vj].dataLim):
                ax[vi, vj].axis("off")

    return ax