##S5 lote 3
s5_day12_3 = excel.crear_array(spiralization_dataframe, 'S5_12', 40, 60)
s5prom_3 = np.average(s5_day12_3)
s5sd_3 = np.std(s5_day12_3, ddof=sample_sd)
s5sem_3 = sem(s5_day12_3) 

proms_3 = [arl_prom_3, s1prom_3, s2prom_3, s3prom_3, s4prom_3, s5prom_3]
errors_3 = np.array([arlsem_3, s1sem_3, s2sem_3, s3sem_3, s4sem_3, s5sem_3])
sd_3 = np.array([arlsd_3, s1sd_3, s2sd_3, s3sd_3, s4sd_3, s5sd_3])
positive_error3 = [np.zeros(len(errors_3)), errors_3]

##Gráfico

bar_1 = np.arange(len(proms_1))
bar_2 = [i + barwidth for i in bar_1]
bar_3 = [i + barwidth for i in bar_2]
ax_1 = lienzo.crear_grilla(2, 2, 4, fig)
# ax_1.set_position([0.06, 0.25, 1, 1], which='original')
graficar.grafica_barras(ax_1, bar_1, proms_1, barwidth, positive_error1, batch1_color, 'Batch 1', error_kw)
graficar.grafica_barras(ax_1, bar_2, proms_2, barwidth, positive_error2, batch2_color, 'Batch 2', error_kw)
graficar.grafica_barras(ax_1, bar_3, proms_3, barwidth, positive_error3, batch3_color, 'Batch 3', error_kw)
plt.xticks([i + barwidth for i in range(len(bar_1))], treatments)
ax_1.set_ylabel('Filament spiralization angle (°)')
plt.ylim(y_lim)
plt.show()


# plt.legend(loc='lower center', bbox_to_anchor=(0.25, -0.15, 0.5, 0.5), ncol=3)
# plt.savefig('D:\Cindy\Ingeniería\Maestría\Resultados\R2L\Gráficos\Modificadas\Final_spiralization_sem.png', dpi=600)
# plt.show() 
s4prom_3 = np.average(s4_day12_3)
s4sd_3 = np.std(s4_day12_3, ddof=sample_sd)
s4sem_3 = sem(s4_day12_3) 

##S5 lote 3
s5_day12_3 = excel.crear_array(spiralization_dataframe, 'S5_12', 40, 60)
s5prom_3 = np.average(s5_day12_3)
s5sd_3 = np.std(s5_day12_3, ddof=sample_sd)
s5sem_3 = sem(s5_day12_3) 

proms_3 = [arl_prom_3, s1prom_3, s2prom_3, s3prom_3, s4prom_3, s5prom_3]
errors_3 = np.array([arlsem_3, s1sem_3, s2sem_3, s3sem_3, s4sem_3, s5sem_3])
sd_3 = np.array([arlsd_3, s1sd_3, s2sd_3, s3sd_3, s4sd_3, s5sd_3])
positive_error3 = [np.zeros(len(errors_3)), errors_3]

##Gráfico
bar_1 = np.arange(len(proms_1))
bar_2 = [i + barspiralization for i in bar_1]
bar_3 = [i + barspiralization for i in bar_2]

ax_1 = lienzo.crear_grilla(1, 1, 1, fig)
# ax_1.set_position([0.06, 0.25, 1, 1], which='original')
graficar.grafica_barras(ax_1, bar_1, proms_1, barspiralization, positive_error1, batch1_color, 'Batch 1', error_kw)
graficar.grafica_barras(ax_1, bar_2, proms_2, barspiralization, positive_error2, batch2_color, 'Batch 2', error_kw)
graficar.grafica_barras(ax_1, bar_3, proms_3, barspiralization, positive_error3, batch3_color, 'Batch 3', error_kw)
plt.xticks([i + barspiralization for i in range(len(bar_1))], treatments)
ax_1.set_ylabel('Filament spiralization angle (°)')
plt.ylim(y_lim)
plt.legend(loc='lower center', bbox_to_anchor=(0.25, -0.15, 0.5, 0.5), ncol=3)
plt.savefig('D:\Cindy\Ingeniería\Maestría\Resultados\R2L\Gráficos\Modificadas\Final_spiralization_sem.png', dpi=600)
plt.show()