def subplot_label(axis, N, plot_idx, varlabels):
    """ Returns a label string for the selected axis """
    label = ''
    if axis == 'x':
        if plot_idx % N == 0:
            label = varlabels[0]
        else:
            label = varlabels[N - plot_idx % N]
    elif axis == 'y':
        label = varlabels[N - 1 - (plot_idx - 1) // N]
    return label
