def get_scaled_bounds(ax, position, *, distance=0.1, factor=200):
    """Get scaled bounds.

    Parameters
    ----------
    ax : Axes object
        Axes object.
    position : {'UL', 'LL', 'UR', 'LR'}
        Position.
    distance : number (optional)
        Distance. Default is 0.1.
    factor : number (optional)
        Factor. Default is 200.

    Returns
    -------
    ([h_scaled, v_scaled], [va, ha])
    """
    x0, y0, width, height = ax.bbox.bounds
    width_scaled = width / factor
    height_scaled = height / factor
    if position == 'UL':
        v_scaled = distance / width_scaled
        h_scaled = 1 - distance / height_scaled
        va = 'top'
        ha = 'left'
    elif position == 'LL':
        v_scaled = distance / width_scaled
        h_scaled = distance / height_scaled
        va = 'bottom'
        ha = 'left'
    elif position == 'UR':
        v_scaled = 1 - distance / width_scaled
        h_scaled = 1 - distance / height_scaled
        va = 'top'
        ha = 'right'
    elif position == 'LR':
        v_scaled = 1 - distance / width_scaled
        h_scaled = distance / height_scaled
        va = 'bottom'
        ha = 'right'
    else:
        print('corner not recognized')
        v_scaled = h_scaled = 1.0
        va = 'center'
        ha = 'center'
    return [h_scaled, v_scaled], [va, ha]
