本文整理汇总了Python中matplotlib.font_manager.FontProperties.get_name方法的典型用法代码示例。如果您正苦于以下问题:Python FontProperties.get_name方法的具体用法?Python FontProperties.get_name怎么用?Python FontProperties.get_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.font_manager.FontProperties
的用法示例。
在下文中一共展示了FontProperties.get_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_times_font
# 需要导入模块: from matplotlib.font_manager import FontProperties [as 别名]
# 或者: from matplotlib.font_manager.FontProperties import get_name [as 别名]
def find_times_font(bold=False, italic=False):
fonts = findSystemFonts()
for fontpath in fonts:
fprop = FontProperties(fname=fontpath)
name = fprop.get_name()
name_matched = 'Times New Roman' in name
pname = os.path.splitext(os.path.basename(fontpath))[0]
style_matched = ((not bold) or (bold and (pname.endswith('Bold') or (pname.lower() == pname and pname.endswith('bd'))))) and \
((not italic) or (italic and (pname.endswith('Italic') or (pname.lower() == pname and pname.endswith('i')))))
if name_matched and style_matched:
return fprop
return None
示例2: findFont
# 需要导入模块: from matplotlib.font_manager import FontProperties [as 别名]
# 或者: from matplotlib.font_manager.FontProperties import get_name [as 别名]
def findFont(self, props):
from matplotlib.font_manager import FontProperties, findfont
# search for the best match
font = FontProperties( fname=findfont( FontProperties(**props) ) )
props = {
'family' : font.get_name(),
'weight' : font.get_weight(),
'style' : font.get_style(),
}
return props
示例3: FontProperties
# 需要导入模块: from matplotlib.font_manager import FontProperties [as 别名]
# 或者: from matplotlib.font_manager.FontProperties import get_name [as 别名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
39. Zipfの法則
単語の出現頻度順位を横軸,その出現頻度を縦軸として,両対数グラフをプロットせよ.
"""
import n36
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
plt.style.use('ggplot')
plt.rcParams['figure.figsize'] = 14, 10
fp = FontProperties(fname="/Library/Fonts/Osaka.ttf")
plt.rcParams['font.family'] = fp.get_name()
def main():
counter = n36.main()
plt.figure()
plt.xscale('log')
plt.yscale('log')
plt.plot(sorted(list(counter.values()), reverse=True), range(1, len(list(counter)) + 1))
plt.savefig('fig39.png')
if __name__ == '__main__':
main()
示例4: _freedman_diaconis_bins
# 需要导入模块: from matplotlib.font_manager import FontProperties [as 别名]
# 或者: from matplotlib.font_manager.FontProperties import get_name [as 别名]
from .report import genwordcloud
from .utils.metrics import entropyc
from .utils import iqr
#from sklearn.neighbors import KernelDensity
import matplotlib.pyplot as plt
import seaborn as sns
_thisdir = os.path.split(__file__)[0]
# default chinese font
from matplotlib.font_manager import FontProperties
font_path=config.font_path
if font_path:
myfont=FontProperties(fname=font_path)
sns.set(font=myfont.get_name())
__all__=['type_of_var',
'describe',
'plot',
'features_analysis',
'distributions',
'AnalysisReport',
'ClassifierReport']
def _freedman_diaconis_bins(a):
"""Calculate number of hist bins using Freedman-Diaconis rule."""
# From http://stats.stackexchange.com/questions/798/
a = np.asarray(a)