def rescale(X, x_min, x_max):
    """
    Rescaled the array of input to the range [x_min, x_max] linearly.
    This method is often used in the context of making maps with matplotlib.pyplot.inshow.
    The matrix to be accepted must contain arrays in the [0,1] range.

    :param X: numpy.ndarray
        This is the input array to be rescaled.
    :param x_min: float or int
        The lower boundary for the array to have.
    :param x_max: float or int
        The upper boundary for the new array to have.

    :return: numpy.ndarray
        The array, linearly rescaled to the range [x_min, x_max].
    """
    nom = (X - X.min(axis=0)) * (x_max - x_min)
    denom = X.max(axis=0) - X.min(axis=0)
    return x_min + nom / denom