2

I'm using matplotlib drawing a scatter chart, I have labels in multiple languages (Chinese, Arabic, Korean...). Now, my chart shows like this: enter image description here

Is there anyway to show this foreign language labels with only matplotlib.pyplot, sys and os library? Thank you.

Jona
  • 1,218
  • 1
  • 10
  • 20
  • Does [How to use unicode symbols in matplotlib?](https://stackoverflow.com/questions/28905938/how-to-use-unicode-symbols-in-matplotlib), [Display foreign language in matplotlib (in virtual env)](https://stackoverflow.com/questions/48374379/display-foreign-language-in-matplotlib-in-virtual-env) or [Non-ASCII characters in Matplotlib](https://stackoverflow.com/questions/10960463/non-ascii-characters-in-matplotlib) answer your question? – funie200 Mar 06 '20 at 07:44

1 Answers1

0

As far as I know from my deliberate search on a similar problem, the only solution I came up with is to specify the missing font packs, download them from google fonts, and use them in matplotlib with the following code. However, I still can not use multiple languages. My solution only solves the problem with one font family. The code below takes the ttf font family from the directory you specified and uses it in the part of the plot you wish by "fontproperties=fprop" argument, here in yticklabels.

from matplotlib import font_manager as fm
fprop = fm.FontProperties(fname='/.../ms-pgothic_bigfontsite.com.ttf')
ax.set_yticklabels(list(hashtag_ordered_keys)[::-1],fontproperties=fprop)
Ipek DK
  • 115
  • 1
  • 9