cf: https://mathsyouth.github.io/2019/06/12/macos-matplotlib
- Run shell command:
fc-list :lang=zh
to find the fonts pathes, e.g. /usr/share/fonts/truetype/bkai00mp.ttf - Follow the python codes below:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
from matplotlib.font_manager import FontProperties
rcParams['axes.unicode_minus']=False
myfont_kai=FontProperties(fname='/usr/share/fonts/truetype/bkai00mp.ttf', size=15)
myfont_ming=FontProperties(fname='/usr/share/fonts/truetype/arphic-bsmi00lp/bsmi00lp.ttf',size=12)
x=np.linspace(0,2*np.pi,100)
plt.plot(x,x)
plt.title("準則", fontproperties=myfont_kai)
plt.ylabel("隸屬度", fontproperties=myfont_ming)