def fmt_scientific(value, pos=None, sfigs=3, min_exponent=2):
    """ format values as scientific value $a \\times 10^b

    Parameters
    ----------
    value: float
    pos:
        for use with matplotlib.ticker.FuncFormatter
    sfigs: int
        number of significat figures
    min_exponent:
        only use power notation if abs(b) >= min_exponent

    Returns
    -------
    value: str

    Examples
    --------
    >>> fmt_scientific(1.0, sfigs=3, min_exponent=2)
    '1.00'
    >>> fmt_scientific(0.123456, sfigs=3, min_exponent=2)
    '0.123'
    >>> fmt_scientific(0.123456, sfigs=3, min_exponent=1)
    '$1.23 \\\\times 10^{-1}$'
    >>> fmt_scientific(1.123456, sfigs=3, min_exponent=2)
    '1.12'
    >>> fmt_scientific(123456, sfigs=3, min_exponent=2)
    '$1.23 \\\\times 10^{5}$'
    >>> fmt_scientific(0.0000123456, sfigs=3, min_exponent=2)
    '$1.23 \\\\times 10^{-5}$'
    >>> fmt_scientific(0.0000123466, sfigs=4, min_exponent=2)
    '$1.235 \\\\times 10^{-5}$'

    """
    base, exponent = '{{:.{}e}}'.format(sfigs - 1).format(value).split('e')
    if abs(int(exponent)) < min_exponent:
        base_len = 0 if str(value).split('.')[0] == '0' else len(str(value)
            .split('.')[0])
        return '{{0:.{}f}}'.format(sfigs - base_len).format(float(value))
    else:
        return '${{0:.{}f}} \\times 10^{{{{{{1}}}}}}$'.format(sfigs - 1
            ).format(float(base), int(exponent))
