Matplotlib画图显示中文错误:RuntimeWarning: Glyph 32929 missing from current font. font.set_text(s, 0.0, fl

问题展示:

https://tushare.pro/document/2

F:\Users\Administrator\lib\site-packages\matplotlib\backends\backend_agg.py:211: RuntimeWarning: Glyph 32929 missing from current font.
  font.set_text(s, 0.0, flags=flags)
F:\Users\Administrator\lib\site-packages\matplotlib\backends\backend_agg.py:211: RuntimeWarning: Glyph 31080 missing from current font.
  font.set_text(s, 0.0, flags=flags)
F:\Users\Administrator\lib\site-packages\matplotlib\backends\backend_agg.py:211: RuntimeWarning: Glyph 36208 missing from current font.
  font.set_text(s, 0.0, flags=flags)
F:\Users\Administrator\lib\site-packages\matplotlib\backends\backend_agg.py:211: RuntimeWarning: Glyph 21183 missing from current font.
  font.set_text(s, 0.0, flags=flags)
F:\Users\Administrator\lib\site-packages\matplotlib\backends\backend_agg.py:211: RuntimeWarning: Glyph 22270 missing from current font.
  font.set_text(s, 0.0, flags=flags)
F:\Users\Administrator\lib\site-packages\matplotlib\backends\backend_agg.py:180: RuntimeWarning: Glyph 32929 missing from current font.
  font.set_text(s, 0, flags=flags)
F:\Users\Administrator\lib\site-packages\matplotlib\backends\backend_agg.py:180: RuntimeWarning: Glyph 31080 missing from current font.
  font.set_text(s, 0, flags=flags)
F:\Users\Administrator\lib\site-packages\matplotlib\backends\backend_agg.py:180: RuntimeWarning: Glyph 36208 missing from current font.
  font.set_text(s, 0, flags=flags)
F:\Users\Administrator\lib\site-packages\matplotlib\backends\backend_agg.py:180: RuntimeWarning: Glyph 21183 missing from current font.
  font.set_text(s, 0, flags=flags)
F:\Users\Administrator\lib\site-packages\matplotlib\backends\backend_agg.py:180: RuntimeWarning: Glyph 22270 missing from current font.
  font.set_text(s, 0, flags=flags)

解决办法:
用于显示中文标签,
解决负号是方块的问题。

plt.rcParams['font.sans-serif']=['SimHei'] #显示中文标签
plt.rcParams['axes.unicode_minus']=False   #解决负号“-”显示为方块的问题

你可能感兴趣的:(python,BUG,乱码,matplotlib)