當前位置: 首頁>>代碼示例>>Python>>正文


Python matplotlib.__file__方法代碼示例

本文整理匯總了Python中matplotlib.__file__方法的典型用法代碼示例。如果您正苦於以下問題:Python matplotlib.__file__方法的具體用法?Python matplotlib.__file__怎麽用?Python matplotlib.__file__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib的用法示例。


在下文中一共展示了matplotlib.__file__方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: write_index

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import __file__ [as 別名]
def write_index():
    """This is to write the docs for the index automatically."""

    here = os.path.dirname(__file__)
    filename = os.path.join(here, '_generated', 'version_text.txt')

    try:
        os.makedirs(os.path.dirname(filename))
    except FileExistsError:
        pass

    text = text_version if '+' not in oggm.__version__ else text_dev

    with open(filename, 'w') as f:
        f.write(text) 
開發者ID:OGGM,項目名稱:oggm,代碼行數:17,代碼來源:conf.py

示例2: write_gdir_doc

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import __file__ [as 別名]
def write_gdir_doc():
    """This is to write the docs for glacierdir automatically."""

    here = os.path.dirname(__file__)
    origfile = os.path.join(here, '_templates', 'basenames.txt')
    filename = os.path.join(here, '_generated', 'basenames.txt')

    try:
        os.makedirs(os.path.dirname(filename))
    except FileExistsError:
        pass

    shutil.copyfile(origfile, filename)

    from oggm.cfg import BASENAMES

    cnt = ['    ']
    for k in sorted(BASENAMES.keys()):
        cnt += [BASENAMES.info_str(k)] + ['    ']
    cnt = '\n'.join(cnt)

    file = open(filename, 'a')
    try:
        file.write(cnt)
    finally:
        file.close() 
開發者ID:OGGM,項目名稱:oggm,代碼行數:28,代碼來源:conf.py

示例3: test_pyplot_up_to_date

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import __file__ [as 別名]
def test_pyplot_up_to_date():
    gen_script = Path(mpl.__file__).parents[2] / "tools/boilerplate.py"
    if not gen_script.exists():
        pytest.skip("boilerplate.py not found")
    orig_contents = Path(plt.__file__).read_text()
    try:
        subprocess.run([sys.executable, str(gen_script)], check=True)
        new_contents = Path(plt.__file__).read_text()
        assert orig_contents == new_contents
    finally:
        Path(plt.__file__).write_text(orig_contents) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:13,代碼來源:test_pyplot.py

示例4: _get_font

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import __file__ [as 別名]
def _get_font(size, font_path=None):
    import matplotlib

    if font_path is None:
        fonts_path = osp.join(
            osp.dirname(matplotlib.__file__), "mpl-data/fonts/ttf"
        )
        font_path = osp.join(fonts_path, "DejaVuSansMono.ttf")
    font = PIL.ImageFont.truetype(font=font_path, size=size)
    return font 
開發者ID:wkentaro,項目名稱:imgviz,代碼行數:12,代碼來源:draw.py


注:本文中的matplotlib.__file__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。