以下の内容はhttps://paper.hatenadiary.jp/entry/2016/11/06/222223より取得しました。


python matplotlib 内で日本語を利用する(使用できるフォントを探す)

利用できるフォントを探す

コード

import matplotlib.font_manager をインポートして findSystemFonts()でフォント一覧を取得します.

gist.github.com

出力

わかりやすいようにjupyter notebookでやってます。

f:id:misos:20161106221810p:plain

matplotlibで使用

fontdict={'family': 'YuGothic'}にてフォントの名前を指定する。

plt.plot([1], 'x')
plt.xlabel(u'あああ', fontdict={'family': 'YuGothic'})
plt.ylabel(u'いいい', fontdict={'family': 'YuGothic'})
plt.show()

f:id:misos:20161106221958p:plain

さらなる詳細は以下で。

pylab_examples example code: fonts_demo.py — Matplotlib 2.0.2 documentation

日本語でラベルや凡例を表示する

paper.hatenadiary.jp




以上の内容はhttps://paper.hatenadiary.jp/entry/2016/11/06/222223より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14