Bruno Justino Praciano
Bruno Justino Praciano

Reputation: 552

Plot min of dataframe using python

I would like to show the minimum point of each curve in this chart. Below is my code for the plot and the dataframe to plot these curves.

def plot_df(df):
    ax = df.plot.line(logy=True,style=['+-','o-','.-','s-','x-'],grid=True,figsize=(10,6))
    ax.set_xticks(plot_1.index)
    plt.xlabel('IR LED Pulse Width (ms)', fontsize=16)
    plt.ylabel('RMSE', fontsize=16)
    plt.legend(['Proposed','FFT','Autocorrelation','Zero crossing','Peak detection'],bbox_to_anchor=(1.04,1), loc="upper left",fontsize=14)
    plt.show()

enter image description here

Dataframe:

enter image description here

Upvotes: 1

Views: 300

Answers (1)

Sameeresque
Sameeresque

Reputation: 2602

The inclusion of the following line in your function would indicate the minimum point of each curve on the chart as 'X' in black color.

df.where(df == df.min(axis=0)).plot(style='X',ax=ax,use_index=True,color='black',legend=False)

Upvotes: 1

Related Questions