Ubuntu环境下matplotlib图例中文乱码

本文前提条件是 已经 安装好 matplotlib  ,  至于 matplotlib 是什么, 怎么安装, 本文不予介绍。

成都创新互联专注于满城企业网站建设,响应式网站,商城网站制作。满城网站建设公司,为满城等地区提供建站服务。全流程按需定制制作,专业设计,全程项目跟踪,成都创新互联专业和态度为您提供的服务

 

Ubuntu环境下 matplotlib 图例中文乱码

Ubuntu环境下 matplotlib 图例中文乱码

 

 

 

首先在  Windows  盘区下  找到   微软雅黑   的字体文件:

Ubuntu环境下 matplotlib 图例中文乱码

 

 

其次,找到 matplotlab  字体库  文件夹    或者   系统字体库文件夹

 

matplotlab  字体库  文件夹

Ubuntu环境下 matplotlib 图例中文乱码

 

Ubuntu环境下 matplotlib 图例中文乱码

 

 

系统字体库文件夹

Ubuntu环境下 matplotlib 图例中文乱码

 

把字体文件拷贝到这两个路径下的任何一个都可以。

 

 

然后,找到 matplotlib  配置文件

Ubuntu环境下 matplotlib 图例中文乱码

 

 

可以直接修改该文件,或者

Ubuntu环境下 matplotlib 图例中文乱码

 

 

然后,  修改配置文件。

编辑该配置文件,找到 font.family ,将注释去掉,在下面的 font.sans - serif :Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial,Helvetica, Avant Garde, sans - serif 加上中文字体 Microsoft YaHei 。

Ubuntu环境下 matplotlib 图例中文乱码

 

 

 

最后,清除缓存

做了上面的更改,发现并没有什么用。

到 ~/.cache/matplotlib下的文件删掉,就ok了。

 

 

 

Ubuntu环境下 matplotlib 图例中文乱码

 

 

 

 


当前题目:Ubuntu环境下matplotlib图例中文乱码
文章分享:http://lszwz.com/article/pghgjp.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款