Created
May 14, 2017 08:04
-
-
Save moskomule/a706c41f87b4e180e14cd3f6058c9bfb to your computer and use it in GitHub Desktop.
settings of Japanese characters in matplotlib figures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
import os | |
# style setting | |
matplotlib.style.use('seaborn-white') | |
# font setting | |
fp = matplotlib.font_manager.FontProperties(fname=os.path.expanduser('~/Library/Fonts/ipaexg.ttf')) | |
plt.rcParams['font.family'] = fp.get_name() | |
plt.plot(0, 1) | |
plt.text(0, 1, "こんにちは世界") | |
plt.show() | |
# if characters are like ▢▢, delete `~/.matplotlib` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment