def calc_hilo(min_val, max_val, df, cols_to_test):
    """ Return lowest and highest values from min_val and max_val if present, or calculate from df. """

    # Calculate (or blindly accept) the range of the y-axis, which must be the same for all four axes.
    if (max_val is None) and (len(df.index) > 0):
        highest_possible_score = max([max(df[col]) for col in cols_to_test])
    else:
        highest_possible_score = max_val
    if (min_val is None) and (len(df.index) > 0):
        lowest_possible_score = min([min(df[col]) for col in cols_to_test])
    else:
        lowest_possible_score = min_val

    return lowest_possible_score, highest_possible_score