当前位置: 首页>>代码示例>>Python>>正文


Python style.reload_library方法代码示例

本文整理汇总了Python中matplotlib.style.reload_library方法的典型用法代码示例。如果您正苦于以下问题:Python style.reload_library方法的具体用法?Python style.reload_library怎么用?Python style.reload_library使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.style的用法示例。


在下文中一共展示了style.reload_library方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: temp_style

# 需要导入模块: from matplotlib import style [as 别名]
# 或者: from matplotlib.style import reload_library [as 别名]
def temp_style(style_name, settings=None):
    """Context manager to create a style sheet in a temporary directory."""
    settings = DUMMY_SETTINGS
    temp_file = '%s.%s' % (style_name, STYLE_EXTENSION)

    # Write style settings to file in the temp directory.
    tempdir = tempfile.mkdtemp()
    with open(os.path.join(tempdir, temp_file), 'w') as f:
        for k, v in six.iteritems(settings):
            f.write('%s: %s' % (k, v))

    # Add temp directory to style path and reload so we can access this style.
    USER_LIBRARY_PATHS.append(tempdir)
    style.reload_library()

    try:
        yield
    finally:
        shutil.rmtree(tempdir)
        style.reload_library() 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:22,代码来源:test_style.py

示例2: temp_style

# 需要导入模块: from matplotlib import style [as 别名]
# 或者: from matplotlib.style import reload_library [as 别名]
def temp_style(style_name, settings=None):
    """Context manager to create a style sheet in a temporary directory."""
    if not settings:
        settings = DUMMY_SETTINGS
    temp_file = '%s.%s' % (style_name, STYLE_EXTENSION)
    try:
        with TemporaryDirectory() as tmpdir:
            # Write style settings to file in the tmpdir.
            Path(tmpdir, temp_file).write_text(
                "\n".join("{}: {}".format(k, v) for k, v in settings.items()))
            # Add tmpdir to style path and reload so we can access this style.
            USER_LIBRARY_PATHS.append(tmpdir)
            style.reload_library()
            yield
    finally:
        style.reload_library() 
开发者ID:holzschu,项目名称:python3_ios,代码行数:18,代码来源:test_style.py

示例3: temp_style

# 需要导入模块: from matplotlib import style [as 别名]
# 或者: from matplotlib.style import reload_library [as 别名]
def temp_style(style_name, settings=None):
    """Context manager to create a style sheet in a temporary directory."""
    if not settings:
        settings = DUMMY_SETTINGS
    temp_file = '%s.%s' % (style_name, STYLE_EXTENSION)

    # Write style settings to file in the temp directory.
    tempdir = tempfile.mkdtemp()
    with open(os.path.join(tempdir, temp_file), 'w') as f:
        for k, v in six.iteritems(settings):
            f.write('%s: %s' % (k, v))

    # Add temp directory to style path and reload so we can access this style.
    USER_LIBRARY_PATHS.append(tempdir)
    style.reload_library()

    try:
        yield
    finally:
        shutil.rmtree(tempdir)
        style.reload_library() 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:23,代码来源:test_style.py

示例4: test_invalid_rc_warning_includes_filename

# 需要导入模块: from matplotlib import style [as 别名]
# 或者: from matplotlib.style import reload_library [as 别名]
def test_invalid_rc_warning_includes_filename():
    SETTINGS = {'foo': 'bar'}
    basename = 'basename'
    with warnings.catch_warnings(record=True) as warns:
        with temp_style(basename, SETTINGS):
            # style.reload_library() in temp_style() triggers the warning
            pass

    for w in warns:
        assert basename in str(w.message) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:12,代码来源:test_style.py


注:本文中的matplotlib.style.reload_library方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。