matplotlib 字体
查看 设置字体 中文字体
from matplotlib.font_manager import FontManager
import subprocess
my_font_path = 'simhei.ttf' # SimHei
FontManager().addfont(my_font_path)
mpl_fonts = set(f.name for f in FontManager().ttflist)
print('all font list get from matplotlib.font_manager:')
for f in sorted(mpl_fonts):
print('\t' + f)
import matplotlib
matplotlib.rc("font", family='SimHei')
import subprocess
my_font_path = 'simhei.ttf' # SimHei
FontManager().addfont(my_font_path)
mpl_fonts = set(f.name for f in FontManager().ttflist)
print('all font list get from matplotlib.font_manager:')
for f in sorted(mpl_fonts):
print('\t' + f)
import matplotlib
matplotlib.rc("font", family='SimHei')