Python Matplotlib Chinese drawing

tags: python  

Articles directory

Configuration method

existdefaultIn the case, Chinese is inpltMiddle will be drawn, Guess it should be because the default font does not include Chinese;

able to passConfiguration fontThe method supports Chinese, most of the blogs are givenSimHei(Black body), but the rendering is not beautiful. After my test, I personally recommend it.SimSun(Song style).

from matplotlib import pyplot as plt
''     two lines configuration '' '
plt.rcParams['font.sans-serif'] = ['SimSun'] # Modify the font as Song style
plt.rcParams['axes.unicode_minus'] = False	# normal display '-'

Preview

image-20210903151336680

Intelligent Recommendation

Python matplotlib drawing can not display Chinese

There are two ways to support Chinese display Method 1: Modify the configuration file of the matplotlib installation package This is not recommended Method two, add settings at the beginning of the pr...

[Python] matplotlib drawing unable to display Chinese solution

First, problem conditions 1. Draw a graph using Matplotlib, but you can't display Chinese in the title and coordinate Second, the solution (one) Add the following sentence to set in Chinese Complete a...

Python matplotlib drawing, what to do in Chinese appearance?

In Python species, use the matplotlib drawing, what should I do if there is garbled in the title? Just add two sentences eg: result eg:...

Python Matplotlib drawing does not display Chinese garbled Chinese fonts

When using Python Matplotlib drawing, because the Matplotlib uses the font of Dejavu Sans default, it does not support Chinese. Therefore So how do we set up to display Chinese? Let me share my experi...

Matplotlib drawing shows Chinese

Because I am using a mac, I will adjust Chinese in Chinese every time I use matplotlib to draw a picture. Simply, remember now One of the more common methods I use 1. Find fonts First find a Chinese f...

More Recommendation

Chinese garbled in matplotlib drawing

In ipython notebook, when we use matplotlib for drawing, Chinese will not be displayed. As shown This is because matplotlib default font does not support Chinese characters, so it needs to be modified...

Matplotlib drawing Chinese characters

1. In the terminal Python environment, check the font path 2, download Simhei Official download URLAnd go to the specified directory:/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sit...

MATPLOTLIB drawing Chinese garbled

Input in the packetplt.rcParams[“font.sans-serif”] = [“SimHei”] After remember that you can't entered when drawing latersns.set(style=“whitegrid”)Otherwise, the plt...

Matplotlib Chinese drawing

MATPLOTLIB.PYPLOT does not support Chinese display by default, and there is no self-contained Chinese font, so you need to download the required fonts yourself and modify the rcparams parameter to dis...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top