I have a dataframe with many columns and data as given below:
rse_df
           Vstart=29V        Vend=37V  ...      Vstart=36V      Vend=37V
0          4.174279            1.0  ...         0.517509            1.0
1          4.032258            1.5  ...              NaN            NaN
2          3.509288            2.0  ...              NaN            NaN
3          3.091149            2.5  ...              NaN            NaN
4          2.746441            3.0  ...              NaN            NaN
5          2.439879            3.5  ...              NaN            NaN
6          2.305721            4.0  ...              NaN            NaN
7          2.057234            4.5  ...              NaN            NaN
8          1.826651            5.0  ...              NaN            NaN
9          1.634388            5.5  ...              NaN            NaN
10         1.479945            6.0  ...              NaN            NaN
11         1.347369            6.5  ...              NaN            NaN
12         1.238585            7.0  ...              NaN            NaN
13         1.106522            7.5  ...              NaN            NaN
14         0.990119            8.0  ...              NaN            NaN
I have plotted and the result is given below:
In plot-legend, all are wrongly represented. If you observe first label 'Vstart=29V' in plot-legend, it is wrongly represented. From dataframe, 'Vstart=29V' column data is represented in top line in pink color but legend says blue color, which is wrong. Looks like something is wrong here.
My code is:
plt.plot(rse_df[rse_df.columns[1::2].values],rse_df[rse_df.columns[0::2].values],'-o',markerfacecolor='none')  
plt.legend(rse_df.columns[0::2].values.tolist(),fontsize=8,ncol=1)
what is wrong in the above code causing this wrong alignment?
Approach1:
sns.lineplot(x=rse_df[rse_df.columns[1::2].values],y=rse_df[rse_df.columns[0::2].values], markers=True)
plt.show()
Output:
raise ValueError('If using all scalar values, you must pass'
ValueError: If using all scalar values, you must pass an index

 
    

