查询matplotlib字体路径
import matplotlib
print(matplotlib.matplotlib_fname())
查看当前字体
from matplotlib.font_manager import fontManager
a=sorted([f.name for f in fontManager.ttflist])
for i in a:
print(i)
设置永久全局有效中文字体
-
下载字体
https://github.com/tonsky/FiraCode/releases/download/2/FiraCode_2.zip -
拷贝到matplotlib字体目录
matplotlib/mpl-data/fonts/ttf -
修改配置matplotlibrc
font.family = Heiti
网友评论