當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。