LoginSignup
2
1

Pythonのmatplotlibのラベルの文字化け対処コード

Posted at

Pythonのmatplotlibグラフのラベルやタイトルが文字化けするとき用のコードです。

#matplotlibラベル文字化け対応用
from matplotlib import rcParams
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = ['Hiragino Maru Gothic Pro', 'Yu Gothic', 'Meirio', 'Takao', 'IPAexGothic', 'IPAPGothic', 'VL PGothic', 'Noto Sans CJK JP']


matplotlibのデフォルト状態では日本語フォントに対応しておらず、日本語をサポートしているフォントを指定する必要があるようです。

2
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
2
1