示例#1
0
def load_style(directory='.', name='kf_book/custom.css'):
    version = [
        int(version_no) for version_no in matplotlib.__version__.split('.')
    ]

    try:
        if sys.version_info[0] >= 3:
            style = json.load(open(os.path.join(directory,
                                                "kf_book/538.json")))
        else:
            style = json.load(open(directory + "/kf_book/538.json"),
                              object_hook=_decode_dict)

        # matplotlib has deprecated the use of axes.color_cycle as of version
        if version[0] > 1 or (version[0] == 1 and version[1] >= 5):
            style[
                "axes.prop_cycle"] = "cycler('color', ['#6d904f','#013afe', '#202020','#fc4f30','#e5ae38','#A60628','#30a2da','#008080','#7A68A6','#CF4457','#188487','#E24A33'])"
            style.pop("axes.color_cycle", None)
        plt.rcParams.update(style)
    except:
        pass
    set_figsize()
    reset_axis()
    np.set_printoptions(suppress=True,
                        precision=3,
                        linewidth=70,
                        formatter={'float': lambda x: ' {:.3}'.format(x)})

    styles = open(os.path.join(directory, name), 'r').read()
    set_figsize()
    return HTML(styles)
示例#2
0
def load_style(directory='.', name='kf_book/custom.css'):
    version = [
        int(version_no) for version_no in matplotlib.__version__.split('.')
    ]

    try:
        if sys.version_info[0] >= 3:
            style = json.load(open(os.path.join(directory,
                                                "kf_book/538.json")))
        else:
            style = json.load(open(directory + "/kf_book/538.json"),
                              object_hook=_decode_dict)
        plt.rcParams.update(style)
    except:
        pass
    set_figsize()
    reset_axis()
    np.set_printoptions(suppress=True,
                        precision=3,
                        threshold=10000.,
                        linewidth=70,
                        formatter={'float': lambda x: ' {:.3}'.format(x)})
    styles = open(os.path.join(directory, name), 'r').read()
    set_figsize()
    # I don't know why I have to do this, but I have to call
    # with suppress a second time or the notebook doesn't suppress
    # exponents
    np.set_printoptions(suppress=True)
    return HTML(styles)
示例#3
0
def load_style(directory='.', name='kf_book/custom.css'):
    version = [
        int(version_no) for version_no in matplotlib.__version__.split('.')
    ]

    try:
        if sys.version_info[0] >= 3:
            style = json.load(open(os.path.join(directory,
                                                "kf_book/538.json")))
        else:
            style = json.load(open(directory + "/kf_book/538.json"),
                              object_hook=_decode_dict)
        plt.rcParams.update(style)
    except:
        pass
    set_figsize()
    reset_axis()
    np.set_printoptions(suppress=True,
                        precision=3,
                        linewidth=70,
                        formatter={'float': lambda x: ' {:.3}'.format(x)})

    styles = open(os.path.join(directory, name), 'r').read()
    set_figsize()
    return HTML(styles)
def load_style(directory = '.', name='kf_book/custom.css'):
        version = [int(version_no) for version_no in matplotlib.__version__.split('.')]

        try:
            if sys.version_info[0] >= 3:
                style = json.load(open(os.path.join(directory, "kf_book/538.json")))
            else:
                style = json.load(open(directory + "/kf_book/538.json"), object_hook=_decode_dict)
            plt.rcParams.update(style)
        except:
            pass
        set_figsize()
        reset_axis ()
        np.set_printoptions(suppress=True, precision=3, 
		                    threshold=10000., linewidth=70,
                            formatter={'float':lambda x:' {:.3}'.format(x)})
        styles = open(os.path.join(directory, name), 'r').read()
        set_figsize()
        # I don't know why I have to do this, but I have to call
        # with suppress a second time or the notebook doesn't suppress
        # exponents
        np.set_printoptions(suppress=True)
        return HTML(styles)
def load_style(directory = '.', name='kf_book/custom.css'):
        version = [int(version_no) for version_no in matplotlib.__version__.split('.')]

        try:
            if sys.version_info[0] >= 3:
                style = json.load(open(os.path.join(directory, "kf_book/538.json")))
            else:
                style = json.load(open(directory + "/kf_book/538.json"), object_hook=_decode_dict)

            # matplotlib has deprecated the use of axes.color_cycle as of version
            if version[0] > 1 or (version[0] == 1 and version[1] >= 5):
                style["axes.prop_cycle"] = "cycler('color', ['#6d904f','#013afe', '#202020','#fc4f30','#e5ae38','#A60628','#30a2da','#008080','#7A68A6','#CF4457','#188487','#E24A33'])"
                style.pop("axes.color_cycle", None)
            plt.rcParams.update(style)
        except:
            pass
        set_figsize()
        reset_axis ()
        np.set_printoptions(suppress=True,precision=3, linewidth=70,
                            formatter={'float':lambda x:' {:.3}'.format(x)})

        styles = open(os.path.join(directory, name), 'r').read()
        set_figsize()
        return HTML(styles)