Chinese characteristic error

import pandas as pd
from matplotlib import pyplot as plt
plt.rcParams[‘font.family’] = 'SimHei’
mask_data_clean = pd.read_csv(’./mask_data_clean.csv’, encoding=‘utf-8’)
order_number = mask_data_clean.groupby(‘月份’)[‘订单量’].sum()
order_number.plot(kind=‘line’, figsize=(6, 6), title=‘各月总订单量趋势图’)

ERROR:findfont: Font family [‘SimHei’] not found. Falling back to DejaVu Sans.

Chinese characteristic cannot display normally :sweat:
any solutions? thanks :grinning:

I solve this problem.
matplotlib in datalore doesn’t support chinese characteristic, becaues ‘matplotlib.font_manager.FontProperties’ don’t have corresponding style. I need to download by myself and set it properly.

from pylab import *
import matplotlib .pyplot as plt
import numpy as np
myfont = matplotlib.font_manager.FontProperties(fname=r"./STFANGSO.ttf")
t = np.arange(-5np.pi, 5np.pi, 0.001)
y = np.sin(t)/t
my_post = plt.plot(t, y)
plt.title(u’matplotlib中文显示测试——Zhengyuan Lan’,fontproperties=myfont)
plt.xlabel(u’这里是X坐标’,fontproperties=myfont)
plt.ylabel(u’这里是Y坐标’,fontproperties=myfont)
plt.show()

4 Likes