import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
plt.rcParams['font.sans-serif']=['STKaiti']
plt.rcParams['axes.unicode_minus']=False
data1 = pd.read_csv('前向.csv')
data2 = pd.read_csv('侧向.csv')
data3 = pd.read_csv('对角线.csv')
steps1 = data1['Step']
values1 = data1['Value']
steps2 = data2['Step']
values2 = data2['Value']
steps3 = data3['Step']
values3 = data3['Value']
window_size = 10
smoothed_values1 = np.convolve(values1, np.ones(window_size)/window_size, mode='valid')
smoothed_steps1 = steps1[window_size-1:]
smoothed_values2 = np.convolve(values2, np.ones(window_size)/window_size, mode='valid')
smoothed_steps2 = steps2[window_size-1:]
smoothed_values3 = np.convolve(values3, np.ones(window_size)/window_size, mode='valid')
smoothed_steps3 = steps3[window_size-1:]
plt.plot(smoothed_steps1, smoothed_values1, color='red', label='v=[0.8,0.0]', linewidth=1.5)
plt.plot(smoothed_steps2, smoothed_values2, color='blue', label='v=[0.0,0.4]', linewidth=1.5, linestyle='--')
plt.plot(smoothed_steps3, smoothed_values3, color='green', label='v=[-0.5,-0.3]', linewidth=1.5, linestyle=':')
plt.xlim(0,None)
plt.xlabel(u'采集次数', fontsize=15)
plt.ylabel(u'综合奖励值', fontsize=15)
plt.xticks(np.arange(0, max(smoothed_steps1)+1, 5000000))
plt.legend(loc="lower right")
ax = plt.subplot()
ax.set_xticks([0, 5000000, 10000000, 15000000, 20000000, 25000000, 30000000, 35000000, 40000000])
ax.set_xticklabels(('0M','5M','10M', '15M', '20M', '25M', '30M', '35M', '40M'))
plt.show()