matplotlib 柱状图加数值标注

matplotlib 柱状图加数值文本标注

x = data2["charge"]
y = data2["f1"]
sup = data2["sup"]


plt.figure(figsize = (10, 8))
plt.bar(x, y)

for a, b, t in zip(x, y, sup):
    plt.text(a, b, t, ha='center', va='bottom', fontsize=15)

plt.xticks(fontsize = 15, rotation=45)
plt.yticks(fontsize = 15)

你可能感兴趣的:(matplotlib 柱状图加数值标注)