matplotlib(Windows11)

インストール

$ conda install matplotlib

日本語化

Google Nato Fontsを使います。

「jp」で検索。
Noto Serif Japanese、Noto Sans Japaneseをダウンロードし、解凍します。

インストールフォントをクリックして、右クリック。
その他のオプションを表示/インストールを選択。

ホームディレクトリ(C:\ユーザー\(ユーザー名))に、フォルダ .matplotlibを作成します。

matplotlibrcの原本は
「anaconda3\Lib\site-packages\matplotlib\mpl-data」にある。

matplotlibrcをフォルダ .matplotlibにコピーする。

【matplotlibrc】

font.serif:Noto Serif JP
font.sans-serif:Noto Sans JP

matplotlibrc にフォントを設定する

font.serif:Noto Serif CJK JP
font.sans-serif:Noto Sans CJK JP

テスト

import matplotlib.pyplot as plt
plt.title('今日はいい天気!')
plt.show()

タイトルとURLをコピーしました