解决matplotlib绘图中显示中文乱码的问题
1. 正确下载字体文件simhei.ttf
2. 将上面下载的文件copy到matplotlib里的对应目录,我的目录是
/Users/xxx/anaconda3/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf
3.rm -rf ~/.matplotlib/*
4.在代码中显式地指定字体
-
import matplotlib
matplotlib.rcParams['font.sans-serif'] = ['SimHei']
#matplotlib.rcParams['font.family']='sans-serif'
matplotlib.rcParams['axes.unicode_minus'] = False
from bkcharts import Bar ,TimeSeries