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()
轉載于:https://www.cnblogs.com/jiujue/p/11299035.html