1.绘制折线图,去上和右边框,显示中文
import numpy as np import matplotlib.pyplot as plt #plt.style.use('default') #plt.close(fig) fig, ax = plt.subplots(figsize=(12, 8)) ax = plt.axes() ax.spines['top'].set_visible(False) #设置去掉上边框 ax.spines['right'].set_visible(False) #设置去掉右边框 ylist=[0.93,0.87,0.93,0.93,0.92,0.92,0.92,0.92] xlist=[5,6,7,8,9,12,15,17] plt.plot(xlist, ylist,c='black',ls='-',marker='+',mec='black',linewidth=1.5) #plt.title("original data") plt.xticks(fontsize=18) plt.yticks(fontsize=18) plt.xlabel("网络层数",fontsize=18) #yLable='\n'.join('精','度') yLable='精 '+'\n'+'度 ' plt.ylabel(yLable,rotation='horizontal',fontsize=18) plt.savefig('5a.eps') plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签 plt.show()
2.保存为eps
# plt调用gcf函数取得当前绘制的figure并调用savefig函数
foo_fig = plt.gcf() # 'get current figure'
foo_fig.savefig('foo.eps', format='eps', dpi=1000)
plt.show()
3.绘图风格
风格:https://blog.csdn.net/qq_42505705/article/details/84962815
4. 折线图参考