从matplotlib中的样式表更改xthicklabels的字体

时间:2015-07-16 12:20:20

标签: matplotlib

我想在matplotlib图的轴上使用非标准字体作为标签。我不能假设用户已经安装了字体,所以我提供了ttf文件。

我通过以下方式开展工作:

fname = '/bla/bla/myfont.ttf'    
ticks_font = matplotlib.font_manager.FontProperties(fname = fontPath, style='normal', size=12, weight='normal', stretch='normal')
for label in ax.get_xticklabels() :
    label.set_fontproperties(ticks_font)

但是,由于我有许多不同样式的图形,我想将所有布局移动到样式表。我试过这样做:

 font.serif : '/bla/bla/myfont.ttf'
 font.family :'serif'

但这似乎不起作用。

0 个答案:

没有答案