matplotlib显示中文(解决UserWarning: findfont: Font family)
2018-02-09 20:56
387 查看
安装了Anaconda3,学着用matplotlib,发现不能显示中文,查阅了网上的方法,对matplotlibrc中的font.family各种改,但Jupyter Noterbook依旧显示UserWarning: findfont: Font family
最终找到解决方法,操作很简单:
在.matplotlib(图一)这个目录里,注意文件夹名字最前面是个点,有个叫fontList.json(图二)的文件,这个目录与我的Anaconda3在同一个目录中,
打开后在ttffiles(图三)对应的列表中显示的就是matplotlib可以加载的字体,涵盖的字体路径有Anaconda自带的,也有系统自带的,我选择了系统自带的黑体(图四),最后打开Anaconda3\Lib\site-packages\matplotlib\mpl-data的matplotlibrc,把font.family改成simhei(图五)(注意去掉前面的#号),重新启动Jupyter Noterbook即可显示中文
![](http://upload-images.jianshu.io/upload_images/9608551-a4e1b6ff1a4d1db5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
图一
![](http://upload-images.jianshu.io/upload_images/9608551-f1e7f827cf3ad189.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
图二
![](http://upload-images.jianshu.io/upload_images/9608551-e67f79b9e35b45e3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
图三
![](http://upload-images.jianshu.io/upload_images/9608551-1009513d4b49ce3b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
图四
![](http://upload-images.jianshu.io/upload_images/9608551-f476287b216a4841.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
图五
WelcomeToMyBlog
最终找到解决方法,操作很简单:
在.matplotlib(图一)这个目录里,注意文件夹名字最前面是个点,有个叫fontList.json(图二)的文件,这个目录与我的Anaconda3在同一个目录中,
打开后在ttffiles(图三)对应的列表中显示的就是matplotlib可以加载的字体,涵盖的字体路径有Anaconda自带的,也有系统自带的,我选择了系统自带的黑体(图四),最后打开Anaconda3\Lib\site-packages\matplotlib\mpl-data的matplotlibrc,把font.family改成simhei(图五)(注意去掉前面的#号),重新启动Jupyter Noterbook即可显示中文
![](http://upload-images.jianshu.io/upload_images/9608551-a4e1b6ff1a4d1db5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
图一
![](http://upload-images.jianshu.io/upload_images/9608551-f1e7f827cf3ad189.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
图二
![](http://upload-images.jianshu.io/upload_images/9608551-e67f79b9e35b45e3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
图三
![](http://upload-images.jianshu.io/upload_images/9608551-1009513d4b49ce3b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
图四
![](http://upload-images.jianshu.io/upload_images/9608551-f476287b216a4841.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
图五
WelcomeToMyBlog
相关文章推荐
- 解决mac系统下Matplotlib 中文显示问题
- matplotlib 中文显示问题的解决办法
- 解决python27 matplotlib 中文不显示问题
- python的matplotlib画图时无法显示中文的解决方法
- Python Matplotlib 中文不正常显示解决记录
- 解决python27 matplotlib 中文不显示问题
- Python 3下Matplotlib画图中文显示乱码的解决方法
- 解决mac上matplotlib(plot)无法显示中文的问题 (Python)
- Python 3下使用Matplotlib工具画图,中文显示乱码的问题解决(修改配置文件)
- 解决python27 matplotlib 中文不显示问题
- 解决matplotlib绘图中显示中文乱码的问题
- matplotlib中文无法显示的解决方法
- 解决matplotlib不能显示中文的问题(Ubuntu)
- 解决python27 matplotlib 中文不显示问题
- 解决Mac系统下matplotlib中文显示方块问题
- 解决matplotlib画图显示中文的问题
- 解决python27 matplotlib 中文不显示问题
- python matplotlib plot 数据中的中文无法正常显示的解决办法
- 解决python27 matplotlib 中文不显示问题
- matplotlib不能显示中文的解决方法