プロットごとに
plt.xlabel("frequency [Hz]", fontsize=18)
と書くのはめんどくさいので、デフォルトの設定を変更する
デフォルトといっても、そのスクリプト内でのみその設定が使われるだけ
import matplotlib as mpl mpl.rcParams['xtick.labelsize'] = 16 mpl.rcParams['ytick.labelsize'] = 16 mpl.rcParams["axes.labelsize"] = 20 mpl.rcParams["axes.titlesize"] = 20 mpl.rcParams["legend.fontsize"] = 20 mpl.rcParams['axes.linewidth'] = 2 mpl.rcParams['figure.facecolor'] = "white" mpl.rcParams['mathtext.fontset'] = 'stix' mpl.rcParams['font.family'] = 'STIXGeneral'
みたいな感じでOK
最後のmpl.rcParams['axes.linewidth'] = 2はplotの枠線の太さを太くするオプション
最後のは画面の背景色を透明から白色にするオプション
from matplotlib import pyplot as plt
じゃないことに注意
■ 過去記事 : Customizing Matplotlib with style sheets and rcParams
これがmatplotlibのオプション大全
同僚が教えてくれた
論文で使えるプロットにしたいときは・・・
import matplotlib as mpl mpl.rcParams['mathtext.fontset'] = 'stix' mpl.rcParams['font.family'] = 'STIXGeneral'
ランキング参加中です
↓クリックしていただけると嬉しいです〜