def scale_y_values(y_data, y_reference, y_max):
    """
    Scale the plot in y direction, to prevent extreme values.
    :param y_data:      the y data of the plot
    :param y_reference: the maximum value of the plot series (e.g. Normal force), which will be scaled to y_max
    :param y_max:       the maximum y value for the plot (e.g. if y_max=1, no y value in the plot will be greater than 1)
    """
    multipl_factor = y_max / y_reference
    for i in range(len(y_data)):
        y_data[i] = y_data[i] * multipl_factor
    return y_data, multipl_factor