本文整理汇总了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)
示例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()
示例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)
示例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