After merging two files, one x value gets repeated twice in the plot

51 Views Asked by At

I have two datasets that I merge into one, and then I make a plot. At this last stage, I get an x value repeated twice ('2 hours'), second point (correct) and also as last x value (wrong). If I plot the individual datasets this problem does not occur. Any idea how to solve the problem?

sns.set_context("paper", font_scale=1.5)
fig, ax = plt.subplots(constrained_layout=True)


file_1 = pd.read_excel(r'.......xlsx')
file_1['Light treatment']='Constant'
file_2 = pd.read_excel(r'.......xlsx')
file_2['Light treatment']='Sinusoidal'

frames = [file_1, file_2]
file = pd.concat(frames)


df_new = file.loc[(file['Time']==50.712336)]


ax= sns.lineplot(x="Sampling", y="NPQ", hue="Light treatment", ci=68, 
marker='s', data=df_new)
plt.show()

correct figure from file 1
correct figure from file 1

wrong figure

0

There are 0 best solutions below