def get_x_scale(xcoordinatemin, xcoordinatemax, xpixelmin, xpixelmax):
    """
    Establishes the scaling from pixels to x axis units. Can also be used for the y scaling, with all 'x'
    in input variables replaced with their 'y' counterparts
    :param xcoordinatemin: number, minimum x (or y) value (from input image)
    :param xcoordinatemax: number, maximum x ( or y) value (from input image)
    :param xpixelmin: int, minimum pixel location along the x (or y) axis
    :param xpixelmax: int, maximum pixel location along the x ( or y) axis
    :return x_scale: a value with units (pixels/coordinate unit) used to scale distances along the x (or y) axis
    """
    # the x pixel and x coordinate count up in the same direction
    pixel_range = xpixelmax - xpixelmin
    coordinate_range = xcoordinatemax - xcoordinatemin
    x_scale = pixel_range / coordinate_range
    return x_scale