def is_log_scale_matrix(matrix):
    """
    This method receives in input a matrix created as
    performance.sel(dataset=X, model=Y) with li and lj as axes.

    In case the first values is at least 2 times bigger than the second values,
    we return True and the matrix will be rescaled in
    plot_rank_confusion_matrix by applying log2; otherwise we return False
    and nothing happens.

    Parameters
    ----------
    matrix : xarray
         created as performance.sel(dataset=X, model=Y) with li and lj as axes

    Returns
    -------
    : bool
        True or False

    """
    flat = matrix.values.flatten()
    flat.sort()
    if flat[-1] / flat[-2] > 2:
        return True
    else:
        return False
