def _compute_preferred_numer_of_labels(
    available_space: int, vertical_direction: bool
) -> int:
    """
    Compute an estimate for the preferred number of labels.
    """
    # For horizontal direction (x axis)
    preferred_number_of_labels = int(available_space / 15)

    if vertical_direction:
        # for y axis
        preferred_number_of_labels = int(available_space / 5)

    return max(2, min(20, preferred_number_of_labels))