RuntimeWarning:Glyph 21435 missing from current font.

Posted Data+Science+Insight

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RuntimeWarning:Glyph 21435 missing from current font.相关的知识,希望对你有一定的参考价值。

RuntimeWarning:Glyph 21435 missing from current font.

 

目录

RuntimeWarning:Glyph 21435 missing from current font.

问题:

#解决:

#完整错误:


问题:

import pandas as pd
import numpy as np
import numpy as np
import pandas as pd
import matplotlib
%matplotlib inline

import plotly as py
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
init_notebook_mode(connected=True)
# import cufflinks as cf
# cf.go_offline()

import matplotlib.pyplot as plt
import seaborn as sns

data = {'产品':['肉类','盐铁','纺织','木材']*2,
        '年份':[1046,1046,1046,1046,1047,1047,1047,1047],
       '诸侯':['秦','齐','楚','燕','赵','魏','韩','西周'],
       '产量':[180,140,300,200,150,60,80,320]}
 
df=pd.DataFrame(data, columns=['产品','年份','诸侯','产量'])
 
df


def bar_plot(df,key):
    df[key].value_counts().sort_index().plot.bar(figsize = (12, 5),
                      edgecolor = 'k', linewidth = 2)

    # Formatting
    plt.xlabel(key); 
    plt.ylabel('COUNT'); 
    plt.xticks(rotation = 60)
    plt.title('BAR PLOT for ' + key);


bar_plot(df[:6],'产品')

RuntimeWarning:Glyph 21435 missing from current font. 

#解决:

#其实本质是中文字体的问题咯,那么就配置字体就好了

#matplotlib

import matplotlib as mpl

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

#seabron

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

#完整错误:

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:238: RuntimeWarning:

Glyph 21435 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:238: RuntimeWarning:

Glyph 37325 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:238: RuntimeWarning:

Glyph 21069 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:238: RuntimeWarning:

Glyph 21518 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:238: RuntimeWarning:

Glyph 22522 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:238: RuntimeWarning:

Glyph 30784 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:238: RuntimeWarning:

Glyph 20449 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:238: RuntimeWarning:

Glyph 24687 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:201: RuntimeWarning:

Glyph 21435 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:201: RuntimeWarning:

Glyph 37325 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:201: RuntimeWarning:

Glyph 21069 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:201: RuntimeWarning:

Glyph 21518 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:201: RuntimeWarning:

Glyph 22522 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:201: RuntimeWarning:

Glyph 30784 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:201: RuntimeWarning:

Glyph 20449 missing from current font.

D:\\anaconda\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:201: RuntimeWarning:

Glyph 24687 missing from current font.

以上是关于RuntimeWarning:Glyph 21435 missing from current font.的主要内容,如果未能解决你的问题,请参考以下文章

C2143 类型的错误 - 在 '<' 之前缺少 ','

错误 C2143 和错误 C2059 缺少“;”前 ””

错误 C2143。为啥 VC++ 找不到我的课程?

MFC error C2143: 语法错误 : 缺少“;”(在“*”的前面)

bzoj 2143: 飞飞侠

error C2143: 语法错误 : 缺少“;”(在“&”的前面)