zoukankan      html  css  js  c++  java
  • win10系统matplotlib中文显示问题

    matplotlib画图时,中文字符显示为乱码,需要自行添加字体库。win10系统自带的字体库和matplotlib不能通用,因此需要在网上下载一个,

    微软雅黑的字体这边收藏在网盘里,可以直接拿去用。https://pan.baidu.com/s/1pCAcbRuIh7WLIfbT-5BbZA

    把字体文件放在D:\Anaconda2\Lib\site-packages\matplotlib\mpl-data\fonts\ttf目录下面,放置目录需要根据自己的安装目录修改一下。

    接下来修改一下配置文件D:\Anaconda2\Lib\site-packages\matplotlib\mpl-data\matplotlibrc 修改非注释部分。

    最后删除一下缓存目录,在路径C:\Users\你的用户名\.matplotlib 把这个.matplotlib整个文件夹删除。

    然后去测试一下能否显示中文,保险起见可以重启一下应用。

    
    

    # The font.size property is the default font size for text, given in pts.
    # 10 pt is the standard value.
    #
    font.family : sans-serif
    #font.style : normal
    #font.variant : normal
    #font.weight : medium
    #font.stretch : normal
    # note that font.size controls default text sizes. To configure
    # special text sizes tick labels, axes, labels, title, etc, see the rc
    # settings for axes and ticks. Special text sizes can be defined
    # relative to font.size, using the following values: xx-small, x-small,
    # small, medium, large, x-large, xx-large, larger, or smaller
    #font.size : 10.0
    #font.serif : DejaVu Serif, Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
    font.sans-serif : Microsoft YaHei, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
    #font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand, cursive

     

    主要步骤只有两步,

    1、添加字体库

    2、修改配置文件

    3、删除缓存目录

  • 相关阅读:
    C#快速随机按行读取大型文本文件
    OpenReadWithHttps
    fiddler不能监听 localhost和 127.0.0.1的问题 .
    C#放缩、截取、合并图片并生成高质量新图的类
    JS判断只能是数字和小数点
    HTML5 Support In Visual Studio 2010
    GridView 获取列字段的几种途径
    微信朋友圈如何同时分享(图片+文字) Android版
    【Android】 PopupWindow使用小结
    Android 第三方应用接入微信平台(2)
  • 原文地址:https://www.cnblogs.com/touristlee/p/8805655.html
Copyright © 2011-2022 走看看