Matplotlib subplot doesnot show the same decimal number in y-axis

Viewed 13

I am plotting different compression test analyses from a file with multiple tabs in a single plot divided into an array of 2x2. It seems like matplotlib automatically places the y-axis ticks, but it's not the same for all, where it should be.

see the code for example:

fig, axes = plt.subplots(2, 2,constrained_layout=True, 
                        figsize=(7,7),)



height=6
diameter=13
Circle_area=3.14159265359*((diameter/2)**2)
Dark2_colors=['seagreen','chocolate','slateblue','deeppink','yellowgreen']
    

for i in np.arange(0,len(sheetnames),1):
    label=sheetnames[i]
    df = pd.read_excel('filename.xlsx',sheet_name = sheetnames[i] ,header= None)
    df = df.iloc[3:] #remove first three rows 
    df.rename(columns = {0:'Standard travel[mm]', 1:'Standard force[N]'},inplace=True)# columns

    df['Strain']=(df['Standard travel[mm]']/height)*100
    df['Stress']=(df['Standard force[N]']/Circle_area)

    y = df['Stress']
    x = df['Strain']

    if i==0:
        axes[0,0].plot(x, y ,,linewidth=1,c=Dark2_colors[i])
              
    elif i==1:
        axes[0,1].plot(x, y,  ,linewidth=1,c=Dark2_colors[i])
   
    elif i==2:
        axes[1,0].plot(x, y,  ,linewidth=1,c=Dark2_colors[i])

    elif i==3:
        axes[1,1].plot(x, y, ,linewidth=1,c=Dark2_colors[i])

        
for ax in axes.flat:

    ax.set_xlabel('Compressive Strain [%]',fontsize=14,fontweight='bold')
    ax.set_ylabel('Compressive Stress [MPa]',fontsize=14,fontweight='bold')
 
for ax in axes.flat:
    ax.label_outer()
    
for ax in axes.flat:
    ax.legend()

the results is in the picture attached. enter image description here

seems like graph 0,0 as different ticks than all of the rest, how can I fix this?

enter image description here

0 Answers
Related