本文整理匯總了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