LoginSignup
0
0

More than 1 year has passed since last update.

matplotlibで日本語を使う(japanize-matplotlib)

Posted at

記事について

matplotlibで日本語を使おうとすると文字化けして不便
japanize-matplotlibというライブラリが便利そう
https://pypi.org/project/japanize-matplotlib/

使い方

通常のmatplotlib

import matplotlib.pyplot as plt

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

plt.show()

Figure_1.png

文字化けしてしまう。

パッケージをインストール

pip install japanize-matplotlib

インポートして普通にmatplotlibで描画

import matplotlib.pyplot as plt
import japanize_matplotlib

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

Figure_1.png

日本語が文字化けせずに描画できて便利。

0
0
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
0
0