V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
dofine
V2EX  ›  Python

关于 matplotlib 中文字体显示不全的问题

  •  
  •   dofine · Apr 26, 2015 · 7843 views
    This topic created in 4023 days ago, the information mentioned may be changed or developed.
    import matplotlib.pyplot as plt
    plt.rcParams['font.sans-serif'] = ['Hiragino Sans GB']
    plt.rcParams['axes.unicode_minus'] = False
    

    这时 plt.xlabel(u'时间') 就是正常文字,但是 plt.xlabel(u'频率') 的话,「频」字就显示为方块了。。

    系统是 OS X,matplotlib 版本1.4.3。

    Supplement 1  ·  Apr 27, 2015
    把字号调大到20之后,之前显示为方块的字均正常了。
    不知道出现异常的根本原因是啥。
    4 replies    2015-04-27 08:52:01 +08:00
    chenbojian
        1
    chenbojian  
       Apr 26, 2015
    感觉你的rcParams设置有点奇怪,没用过osx,你可以在最后再输出下配置信息看是不是你想要的
    dofine
        2
    dofine  
    OP
       Apr 26, 2015
    @chenbojian 谢谢!
    我把字号调大一号就显示正常了。。orz。。
    dawnyesky
        3
    dawnyesky  
       Apr 27, 2015
    你那个是什么字体,支持所有中文字?为什么不用SimHei SimSun这些常用字体?
    dofine
        4
    dofine  
    OP
       Apr 27, 2015
    @dawnyesky Mac 上的冬青黑。。随便找了一个就放上了,试过 Mac 上的黑宋,也有这个问题。
    不过把字号调到20号的时候都正常显示了。。
    谢谢你。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1874 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 00:01 · PVG 08:01 · LAX 17:01 · JFK 20:01
    ♥ Do have faith in what you're doing.