diff --git a/functions.py b/functions.py index e71da69..592eb2d 100644 --- a/functions.py +++ b/functions.py @@ -254,6 +254,16 @@ def barPlot(project_folder,DBP,MBP,SBP,PP,Q_avg,save_path): autolabel(rects1) autolabel(rects2) + # Create labels + err = [] + zip_object = zip(CFD, aimed) + for x1_i, x2_i in zip_object: + err.append(round((x1_i-x2_i)/x2_i*100,2)) + + # Text on the top of each barplot + for i in range(len(x)): + plt.text(x = x[i]- width/2, y = max(CFD[i],aimed[i])+0.15*max(max(CFD,aimed)), s = str(err[i])+'%', fontsize = 8, color='r') + fig.tight_layout() # plt.show() plt.savefig(save_path + '/'+name+'_bar.pdf')