I want to make a graph based on a data frame that has a column with Chinese characters. But the characters won't show on the graph, and I received this error.
C:\Users\march\anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py:238: RuntimeWarning: Glyph 19996 missing from current font.font.set_text(s, 0.0, flags=flags
this is the picture of the graph.
Thanks in advance!
You will need to ensure that you are using a font that has the glyphs you want to use. Take a look at text with non-latin glyphs
From the above link:
As of v2.0 the default font, DejaVu, contains glyphs for many western alphabets, but not other scripts, such as Chinese, Korean, or Japanese.
To set the default font to be one that supports the code points you need, prepend the font name to 'font.family' or the desired alias lists
import matplotlib
matplotlib.rcParams['font.sans-serif'] = ['Source Han Sans TW', 'sans-serif']