matplotlib setting zh-hans
Posted jiujue
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了matplotlib setting zh-hans相关的知识,希望对你有一定的参考价值。
1 from matplotlib import pyplot as plt 2 from matplotlib import font_manager 3 4 import random 5 # you font famaily location 6 font_pro = font_manager.FontProperties(fname=‘C:\Windows\Fonts\SIMYOU.TTF‘) 7 8 9 x=range(0,12,) 10 11 y=[random.randint(10,40) for it in range(0, 12) ] 12 13 xlabels=[‘第次‘.format(i) for i in range(12)] 14 # add the kwarg 15 plt.xticks(x,xlabels,fontproperties=font_pro) 16 17 plt.plot(x,y) 18 plt.show()
以上是关于matplotlib setting zh-hans的主要内容,如果未能解决你的问题,请参考以下文章