How to set the number on x axis as I wish, after I extract the feature data?

Viewed 33
def extract_point(data_list):
    data_list_new = []
    for i in range(len(data_list)):
        if i % 2 == 0 :
            data_list_new.append(data_list[i])
        else:
            continue
    return data_list_new
A = [1,2,5,8,11,15,16,19,22,28,34,36,29,30,41,48,49,55,61,68]
B = [0,3,7,6,3,10,15,12,16,17,19,25,28,29,32,34,38,36,44,52]
C = [1,1,4,7,9,13,19,21,25,24,28,31,34,39,45,43,48,50,52,58]

A_ = extract_point(A)
B_ = extract_point(B)
C_ = extract_point(C)

rewards=np.vstack((A_, B_, C_)) 
df = pd.DataFrame(rewards).melt(var_name='Episode',value_name='MeanReward')

sns.lineplot(x='Episode',y='Mean Reward',linewidth = 0.5 , data=df,palette='Blues_d')

plt.xlabel("Episode")
plt.ylabel("Mean Reward")
plt.show()

Here is my sample code, the length of original data is 20, after I extract points, it decreases to 10, but I still want to plot it with a x axis from 0 to 20. I want to know how to set the x axis with the number I want

0 Answers
Related