1. 程式人生 > >matplotlib圖例、標籤、座標軸刻度的字型設定

matplotlib圖例、標籤、座標軸刻度的字型設定

把字型都設定成為“Times New Roman”

plt.figure(figsize=[15,8])
plt.scatter(X, Y, label = 'RealValue')
plt.plot(X, func(X, a, b), 'red', label = 'CurveLine')
plt.title(station, fontdict={'family' : 'Times New Roman', 'size'   : 16})
plt.ylabel('Clocks($\mu S$)', fontdict={'family' : 'Times New Roman', 'size'   :
16}) plt.xlabel('Time', fontdict={'family' : 'Times New Roman', 'size' : 16}) plt.yticks(fontproperties = 'Times New Roman', size = 14) plt.xticks(fontproperties = 'Times New Roman', size = 14) plt.legend(prop={'family' : 'Times New Roman', 'size' : 16}) plt.savefig('./stationClocks/' + station +
'.ps', dpi = 200) plt.show()

在這裡插入圖片描述