matplotlib指定字体

Use customized font along with matplotlib

check matplotlib set_title, matplotlib Text and matplotlib font_manager
also check stackoverflow

plt.style.use(["zs"])
title_fontP = fontill_manager.FontProperties()
title_fontP.set_family('Microsoft Yahei')
title_fontP.set_size(28)
fig2 = plt.figure(figsize=(16, 18))
fig2.subplots_adjust(hspace=0.3, wspace=0.2)
ax2 = fig2.subplots(3, 2)
ax2[0, 0].plot(pure_spectra_2[:, 0], pure_spectra_2[:, 1])
ax2[0, 0].set_title("纯物质光谱", fontproperties=title_fontP)
ax2[0, 1].plot(wavelength, raw_data.T, lw=1)
ax2[0, 1].set_title("原始光谱", fontfamily="Microsoft Yahei")
ax2[1, 0].plot(wavelength, as_data.T, lw=1)
ax2[1, 0].set_title("AutoScale")
ax2[1, 1].plot(wavelength, snv_data.T, lw=1)
ax2[1, 1].set_title("SNV")
ax2[2, 0].plot(wavelength, sg1st_data.T, lw=1)
ax2[2, 0].set_title("SG-1st")
plt.delaxes(ax2[2, 1])