matplotlibの備忘録
アジェンダ
matplotlib は良い意味でも悪い意味でも、非常にたくさんの関数があり細やかな設定を行うことができます。 また、同じ図を作る過程でも様々な方法で作成することができます。 よって、matplotlibを使う過程で実装方法に悩んでしまう場合があると思います。 そのような悩みを少しでも解消するための記事です。
テンプレ
fig = plt.figure(figsize=[10,7], dpi=300, linewidth=0.0, tight_layout=T) axs = fig.subplots('縦', '横') ax = axs['数字'] size_f = 'あらかじめ宣言' ax.plot(x, y) ax.set_xlabel('ラベル', fontname='Meiryo', fontsize=size_f) ax.set_ylabel('ラベル', fontname='Meiryo', fontsize=size_f) ax.set_xlim(x[0], x[-1]) ax.set_ylim('数字', '数字') fig.align_ylabels()
コンテンツ
2021年11月11日
plt.figure(tight_layout=T)によってthe padding between and around subplotsを自動的に調整できる。
fig.align_ylabels()によってthe ylabels of subplots in the same subplot columnを同じ列に自動的に並べられる。