Adding percentage error plot bar
This commit is contained in:
parent
a0040a7090
commit
070428663c
10
functions.py
10
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')
|
||||
|
|
Loading…
Reference in New Issue
Block a user