字体的不匹配
matplotlib.rcParams['font.sans-serif'] = ['SimHei']
def statistic_div_num():
mysql=MysqlConnect()
chinfo = matplotlib.font_manager.FontProperties(fname='C:/Windows/Fonts/STXINGKA.TTF')
area_type=['动画','国漫相关','音乐','舞蹈','游戏','科技','数码','生活','鬼畜','时尚','娱乐','影视']
url_Dict=getURLFormBilibili()
counts=[]
for type in area_type:
count=0
for table_Name in url_Dict.keys():
if type in table_Name:
getNameSql=mysql.getTableItemNum(table_Name)
print(mysql.queryOutCome(getNameSql)[0][0])
count+=mysql.queryOutCome(getNameSql)[0][0]
counts.append(count)
matplotlib.rcParams['font.sans-serif'] = ['SimHei']
plt.pie(counts,labels=area_type,autopct='%1.1f%%')
plt.show()
原文:https://www.cnblogs.com/mengxiaoleng/p/11695069.html