import matplotlib
# 日本語設定のため、設定ファイルの場所を確認しておく
matplotlib.get_configdir()
# 現在のフォント確認(デフォルトは'sans-serif')
matplotlib.rcParams['font.family']
# 日本語フォントを設定
font_options = {'family': 'Hiragino Sans'}
plt.rc('font', **font_options)
# PDF出力時のエラー解消方法(Error「The PDF backend does not currently support
# http://phyletica.org/matplotlib-fonts/
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
japanize_matplotlib
$ python -m pip install japanize_matplotlib
import japanize_matplotlib
import matplotlib.pyplot as plt