0
我運行下面的代碼,我得到的錯誤 OSERROR:[錯誤2]沒有這樣的文件或目錄:」 .... /代碼/ cmmi12'matplotlib乳膠字體編碼錯誤
看來,該錯誤與某些字體的不可用性有關。除了非英文語言包之外,我已經完成了texlive安裝。
import matplotlib.pyplot as plt;
import numpy as np;
from matplotlib import rc;
filename = 'eg.pdf';
fig, ax1 = plt.subplots(frameon=False);
rc('mathtext', default='regular');
rc('lines',lw=2.6);
rc('lines',mew=2.4);
rc('text', usetex=True);
x = np.array([5,10,25,50]);
am_eg = np.array([5.0, 8.43, 16.93, 29.36]);
lc_eg = np.array([6.22, 10.36, 17.88, 29.74]);
sub_eg = np.array([0, 0, 0, 0]);
lns1 = ax1.plot(x,am_eg,'bs:', label='AM');
lns2 = ax1.plot(x,lc_eg,'bs--',label="LC\n($\lambda$=.5)");
lns3 = ax1.plot(x,sub_eg,'bs-.',label='SUB');
ax1.set_ylabel('EG',color='b',size=14);
ax1.set_ylim([2,32]);
ax1.set_xlim([0,55]);
ax1.set_xticks(x);
ax1.tick_params(axis='y', which=u'both', length=0, labelsize=14, colors='b');
ax1.tick_params(axis='x', which=u'both', length=0, labelsize=14);
lns = lns1 + lns2 + lns3;
labs = [l.get_label() for l in lns];
ax1.set_xlabel('\#',size=14);
lgd = ax1.legend(lns, labs, bbox_to_anchor=(-0.5,-0.5),loc='upper center', ncol = 2, fontsize='12',shadow=True,fancybox=True);
fig.savefig(filename,format='pdf',transparent=True, bbox_extra_artists=(lgd,), bbox_inches='tight');
任何人都可以幫忙嗎?