Python matplotlib Chinese garbled

Source: Internet
Author: User

1. Locate the Matplotlib configuration file Matplotlibrc in the Python installation directory

Mine is C:\Python27\Lib\site-packages\matplotlib\mpl-data.

2. #font. Family, remove its comment, and the value after the colon changes to Microsoft Yahei

3. #font. Sans-serif, remove its annotations, and add Microsoft Yahei to the front of the colon

4. Copy the file. C:\Windows\Fonts\ find the font file of Microsoft Ya-hei msyh.ttf

Copy to

C:\Python27\Lib\site-packages\matplotlib\mpl-data\fonts\ttf

Reference:

A workaround for the Chinese not displaying correctly in the Python matplotlib plot data

Python matplotlib Chinese garbled

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.