import numpy as np
import matplotlib.pyplot as plt
pos=np.array([0.05,0.5,0.97,3])
data_m1=np.array([0.088,0.093,0.098,0.116])
data_m2=data_m1-0.01
data_m3=data_m1-0.02
fig = plt.figure(figsize=(5, 4))
plt.rcParams['xtick.direction'] = 'in' # 将x周的刻度线方向设置向内
plt.rcParams['ytick.direction'] = 'in' # 将y轴的刻度方向设置向内
plt.rcParams['axes.unicode_minus']=False
# plt.rcParams['font.family'] = ["Times New Roman"] # 字体设置为Times NewRoman
plt.rcParams['font.sans-serif'] = ['SimHei']
clist = ['blue', 'red', 'green', 'black', 'darkgreen', 'lime', 'gold', 'purple', 'green', 'cyan', 'salmon', 'grey','mediumvioletred', 'darkkhaki', 'gray', 'darkcyan', 'violet', 'powderblue']
markerlst = ['o', '*', 'x', '>', '<', '^', 'D', 'd', '1', '2', '3', '4', 'o', '*', 'x', '>', '<', '^', 'D', 'd','1', '2', '3', '4', 'o', '*', 'x', '>', '<', '^', 'D', 'd', '1', '2', '3', '4']
linestylelst = ['-', '--', '-.', ':', '-', '--', '-.', ':', '-', '--', '-.', ':', '-', '--', '-.', ':', '-', '--','-.', ':', '-', '--', '-.', ':']
plt.plot(pos, data_m1, c=clist[0], marker=markerlst[0], markersize='10', linewidth='3',linestyle=linestylelst[0], label='origin')
plt.plot(pos, -data_m1, c=clist[0], marker=markerlst[0], markersize='10', linewidth='3',linestyle=linestylelst[0])
plt.plot(pos, data_m2, c=clist[1], marker=markerlst[1], markersize='10', linewidth='3',linestyle=linestylelst[1], label='origin-10')
plt.plot(pos, -data_m2, c=clist[1], marker=markerlst[1], markersize='10', linewidth='3',linestyle=linestylelst[1])
plt.plot(pos, data_m3, c=clist[2], marker=markerlst[2], markersize='10', linewidth='3',linestyle=linestylelst[2], label='origin-20')
plt.plot(pos, -data_m3, c=clist[2], marker=markerlst[2], markersize='10', linewidth='3',linestyle=linestylelst[2],)font1 = {'family': 'SimHei', 'weight': 'normal', 'size': 16}
# 图例展示位置,数字代表第几象限
plt.legend(loc=0, prop=font1, ncol=4, framealpha=0.5)
# plt.xticks(xs[2:])
# plt.yticks(np.linspace(0.118, 0.156, 20))
plt.grid(True, linestyle='--', alpha=0.5)
plt.xlabel("到钻尖的距离(mm)", fontdict={'size': 16})
plt.ylabel("芯厚(mm)", fontdict={'size': 16})
plt.title("web thickness", fontdict={'size': 20})
fig.autofmt_xdate()
plt.show()figure1 = fig.get_figure() # 获取图形
figure1.savefig("C:\\Users\\user\\Documents\\1.jpg", dpi=300)