更换plt字体
1 | #Windows环境为Win10,系统自带字体为ttf格式 |
全局字体设置1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#plt.colorbar字体更换
[linux]# cd /home/usrname/.cache/matplotlib
[linux]# vim fontlist-v310.json fontlist-v310.json
# 在ttflist中添加你想要的字体
{
"fname": "字体路径",
"name": "Times New Roman", #调用时的字体名称
"style": "normal",
"variant": "normal",
"weight": 700,
"stretch": "normal",
"size": "scalable",
"__class__": "FontEntry"
},
[linux]# 在程序中设置plt的全局字体
##------.py Start------##
plt.rcParams['font.family'] = 'Times New Roman'
##------.py End------##