Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@buzztaiki
Last active April 2, 2016 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buzztaiki/b5a03525952a18d161a94376c8f74d65 to your computer and use it in GitHub Desktop.
Save buzztaiki/b5a03525952a18d161a94376c8f74d65 to your computer and use it in GitHub Desktop.
matplotlib で日本語フォントを使う

~/.config/matplotlib/matplotlibrc に以下を書いておく:

font.serif: IPAPMincho
font.sans-serif: IPAPGothic

もし ~/.cache/matplotlib/ があれば、そこにフォントキャッシュがあるので削除しておく。

個別に設定したい場合は http://qiita.com/canard0328/items/a859bffc9c9e11368f37 とかを参照。

プログラム全体に指定した場合は以下のようにする:

import matplotlib as mpl
mpl.rcParams['font.serif'] = 'IPAPMincho'
mpl.rcParams['font.sans-serif'] = 'IPAPGothic'

参考: http://matplotlib.org/users/customizing.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment