LoginSignup
391

More than 1 year has passed since last update.

pip install して import するだけで matplotlib を日本語表示対応させる

Last updated at Posted at 2018-10-09

環境依存もしないですし、面倒臭い設定ファイルの書き換えなども必要ありません。

利用方法

1. 日本語化モジュールをインストール

pip

pip install japanize-matplotlib

conda

conda install -c uehara1414 japanize-matplotlib

2. グラフを表示する前に本モジュールをインポートする

import matplotlib.pyplot as plt
import japanize_matplotlib  # <- これ

plt.plot([1, 2, 3, 4])
plt.xlabel('簡単なグラフ')
plt.show()

3. 実行!

demo

リポジトリ

アップデート履歴

  • 2019/09/08 一部環境においてimport時にエラーが発生する不具合を修正 (@elnikkisさん、ありがとうございます)

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
391