3
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

matplotlibで簡単に日本語フォント設定

Posted at

ダウンロードなどすることなく、リストから確認してファイルを少し編集するだけで設定できました。

環境

terminal
$ uname -a
Linux debian 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u1 (2017-06-18) x86_64 GNU/Linux
$ cat /etc/debian_version
9.0
$ python3 --version
Python 3.5.3
$ python3 -c "import matplotlib; print(matplotlib.__version__)"
2.0.0

確認

terminal
$ python3 -c "import matplotlib as mpl; print(mpl.matplotlib_fname())"
/etc/matplotlibrc
$ python3 -c "import matplotlib.font_manager; print([f.name for f in matplotlib.font_manager.fontManager.ttflist])" | grep  --color=auto -i gothic
['STIXGeneral', ... , 'IPAGothic',  ...  'MathJax_SansSerif']

探している文字が色付き強調されているので、すぐに見つけられます。

設定ファイル編集

$ sudo vim /etc/matplotlib

font.family: IPAGothic に置き換える。

3
6
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
3
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?