参考链接:https://www.jianshu.com/p/240ea3ae0dc9
在使用matplotlib画饼状图时,遇到了如下问题
UserWarning: findfont: Font family [u'sans-serif'] not found. Falling back to DejaVu Sans (prop.get_family(), self.defaultFamily[fontext]))
解决方案如下:
1. 找到matplotlibrc这个文件 --》 搜索axes.unicode_minus --》去掉前面的#,后面的值写为False,这个是用来正常显示负号
2. 搜索font.sans-serif --》去掉前面的#,后面的值写为SimHei,这个是正常显示中文。
3. 如果还是不行的话,记得删除文件夹
C:Users用户名.matplotlib
画出来的饼状图:
哈哈哈。