def check_bounds(d, xmin=None, xmax=None):
    """Check if we need to apply strict bounds."""
    if len(d) > 0:
        if xmin is not None and d.min() - xmin > 0.01 * (d.max() - d.min()):
            xmin = None
        if xmax is not None and xmax - d.max() > 0.01 * (d.max() - d.min()):
            xmax = None
    return xmin, xmax
