Chinese fonts cannot be displayed when drawing charts: Glyph 22885 missing from current font. font.set_text(s, 0.0, flags=flags)

Problem Description

问题:Glyph 22885 missing from current font. font.set_text(s, 0.0, flags=flags):Insert image description here

When using matplotlib to draw a chart, the Chinese title cannot be displayed, prompting Glyph 22885 missing from current font. font.set_text(s, 0.0, flags=flags)

Insert image description here

Cause Analysis:

Reason: Chinese font is not set


solution:

matplotlib is set up using the following code:

import matplotlib as mpl
 
mpl.rcParams['font.sans-serif'] = ['SimHei']
mpl.rcParams['font.serif'] = ['SimHei']

Insert image description here

seabron is set up using the following code:

sns.set_style('whitegrid',{
    
    'font.sans-serif':['SimHei','Arial']})

Guess you like

Origin blog.csdn.net/weixin_61472217/article/details/131141333