1 plt.bar(left =x_label ,height = tuple_val,width = 0.35) 2 3 for a,b in zip(x_label,tuple_val): 4 plt.text(a, b+0.05, '%.2f' % b, ha='center', va= 'bottom',fontsize=11) 5 plt.legend() 6 plt.show()
使用text对柱状图添加标签