matplotlib绘制图像设置中⽂宋体,英⽂新罗马,字体⼤⼩7.5,坐标轴刻度线内 侧
import matplotlib
import numpy as np
回首黄土地import matplotlib.pyplot as plt
from matplotlib import rcParams
matplotlib.use("pgf")
pgf_config ={
"font.family":'serif',
"font.size":7.5,#字体⼤⼩7.5
"fonts":False,
"text.usetex":True,
"pgf.preamble":[
网睡r"\usepackage{unicode-math}",
r"\setmainfont{Times New Roman}",
r"\usepackage{xeCJK}",
r"\setCJKmainfont{SimSun}",
],
}
rcParams.update(pgf_config)
x =[1,2,3,4,5]
y_y=[0.5,0.6,0.7,0.8,0.9]#原始图⽚代数几何
妈祖城网#Params['font.sans-serif'] = ['Microsoft YaHei']
#Params['axes.unicode_minus'] = False
流量生成
#plt.figure(50)
for i in range(len(y_y)):
<(x[i], y_y[i]+0.01,'%.3f'%(y_y[i]),ha='center')
plt.plot(x, y_y,'rp--')#,label='Integrated algorithm'
#plt.plot(x, y_1,'bp--',label='01')
rbd-573#plt.plot(x, y_2,'rp--',label='03')
#plt.plot(x, y_200,'gp-',label='data=200')
# set x limits
plt.xlim((0.8,5.2))
plt.ylim((0.8,1))
#plt.xlabel('Number of data preprocessing',fontsize=13)>####x轴代表plt.xlabel('横纵')
plt.ylabel('纵轴')>>##y轴代表plt.title('标题')>>#title 14#plt.legend(loc='upper left',fontsize=13)
#plt.show()
plt.savefig('./集成2.png', dpi=800)
第⼀次运⾏需要安装插件,需要等待⼀会,安装完毕重新运⾏等待运⾏结束,查看保存图⽚的路径即可