Python matplotlib Chinese settings

tags: Python  matplotlib  matplotlib Chinese settings  python matplotlib font setting Chinese  matplotlib Chinese font common settings  

Found a better way to set up Chinese

# View font library
import matplotlib
font_list=sorted([f.name for f in matplotlib.font_manager.fontManager.ttflist])

for i in font_list:
    print (i)

There will be many, and then find a font to set it up

As long as this sentence is fine, the font can be modified by itself

# Set font
plt.rcParams['font.family'] = ['Arial Unicode MS']

The method I usually use is like this

my_font = font_manager.FontProperties(fname='./simhei.ttf')

# Every time you set the property, write it: fontproperties=my_font
 # Such as: 

 plt.xlabel('x-axis label', fontproperties=my_font)
 plt.ylabel('y axis label', fontproperties=my_font)
 plt.title('title', fontproperties=my_font)

I feel very troublesome, and using the above method, this property does not need to be set! ! !

Intelligent Recommendation

python matplotlib show Chinese

python matplotlib show Chinese matplotlib Chinese display problem As shown in the Chinese display error Add the following sentence...

Matplotlib in Python Display Chinese

When you use the neural network to make a mnist handwritten data set, you want to display the results with the line diagram, the results in the x, y-axis, and title display garbled, here back up a sim...

Python matplotlib shows Chinese

How to display Chinese about python matplotlib Modify file Name on how to get font Use Chinese when drawing in Python Modify file Environment: Windows + Anaconda Open your Anaconda installation locati...

Python matplotlib drawing Chinese

When using MatPlotLib in Python, you will encounter some problems, the solutions are as follows: Complete example Ref: MATPLOTLIB Perfect Chinese Show...

Python Matplotlib Chinese drawing

Articles directory Configuration method Preview Configuration method existdefaultIn the case, Chinese is inpltMiddle will be drawn▯, Guess it should be because the default font does not include Chines...

More Recommendation

Mac matplotlib the Chinese system display settings

When using matplotlib drawing, Chinese labels and titles not display properly. Add the following code is displayed in Chinese, still not display correctly: Search problem, find mac computer system doe...

Under Mac display settings matplotlib Chinese

https://www.jianshu.com/p/140bd6542f30 Mac display the Chinese provided matplotlib 2019.01.13 22:28:48 Word Count 80 Reading 284 Since Mac system comes with Chinese font, Arial Unicode MS is the one. ...

Matplotlib drawing Chinese font garbled settings

Matplotlib drawing Chinese font garbled settings Matplotlib drawing Chinese font garbled settings 1. Basic font settings 2. Other fonts: Three, show it: 4. Operation results: Matplotlib drawing Chines...

06【matplotlib】04matplotlib settings display Chinese

example So here comes the question: If the list a represents the temperature every minute from 10 o'clock to 12 o'clock, how to draw a line graph to observe the change of the temperature every minute?...

Settings Chinese title When Matplotlib Drawing

Enter the following code in your code...

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

Top