LoginSignup
1
1

More than 5 years have passed since last update.

matplotlibを日本語対応に

Last updated at Posted at 2018-06-03

たくさん記事があるけどはまったのでメモ。
環境はCentOS7,python3。

matplotlibrcファイルの場所

Jupyter notebookに次を入力

import matplotlib
matplotlib.matplotlib_fname()

私の環境ではAnacondaからインストールしたので次のような感じ。
/(username)/anaconda3/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc

フォント(ttf)ファイルを置く場所

上記 matplotlibrc と同じフォルダにある./fonts/ttf下。
先ほどの例で具体的には
/(username)/anaconda3/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf下。

DBの再構成

いろんな記事でfontList.py3k.cachを削除するように,とあったけどファイルが見つからなかった。
次のように一度rebuildすることで解決。

matplotlib.font_manager._rebuild()
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1