I'm trying to plot a bar graph where the xtick labels are in Japanese.
After first getting a RuntimeWarning: Glyph <some number> missing from current font. I found xticks's argument fontproperties. Using it as shown in below minimal example, the first of the xtick labels is properly shown in the font I specified, but all following labels are still the missing character rectangles (see image).
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
fprop = fm.FontProperties(fname='NotoSansCJKjp-Regular.otf')
d = {'a': {'ほげイ': 5250.0,
'ほげロ': 1497.0,
'ほげハ': 810.0},
'b': {'ほげイ': 1707.0,
'ほげロ': 507.0,
'ほげハ': 305.0}}
df_foo = pd.DataFrame.from_dict(d)
df_foo.plot(kind='bar')
plt.xticks(fontproperties=fprop, fontsize=15)
plt.show()
Here's an image of the output.
Any idea why this happens or how the font of all xtick labels can be specified?
Thanks in advance for any pointers.