matplotlib set the display Chinese

mac:
Since Mac system comes with Chinese font, Arial Unicode MS is the one. No need to install fonts, do not need to modify the configuration file.

import matplotlib.pyplot as plt
plt.rcParams["font.family"] = 'Arial Unicode MS'
#可用以下语句列出matploylib支持的字体文本;
import matplotlib
a=sorted([f.name for f in matplotlib.font_manager.fontManager.ttflist])
for i in a:
    print i

windows:

#导入的黑体
plt.rcParams['font.family'] = ['SimHei']

Knowledge Reference:
mac Chinese font set methods source: Mac next set matplotlib display Chinese

Published 73 original articles · won praise 24 · views 2561

Guess you like

Origin blog.csdn.net/weixin_44943394/article/details/104760476