简体   繁体   English

条形图上的不需要的标签与matplotlib

[英]Unwanted labels on bar plot with matplotlib

I get zero's on all my bars, despite trying to remove them by setting yerr=None, I'm still getting the same issue. 我在我的所有酒吧都得到零,尽管设法通过设置yerr = None来删除它们,我仍然遇到同样的问题。 The bars otherwise plot correctly. 否则条形图正确。 How can I remove the 0 that I get printed above each bar. 如何删除每个条形图上方打印的0。

N = len(my_tuple)
plt.figure(0)
ind = np.arange(N)  
width = 0.35       
fig, ax = plt.subplots()
rects1 = ax.bar(ind, g_tuple, width, color='r',  linewidth=2,alpha=0.8)
rects2 = ax.bar(ind+width, f_tuple, width, color='y', linewidth=2,alpha=0.8)
ax.set_ylabel('XXX')
ax.set_title('XXX')
ax.set_xticks(ind+width)
ax.set_xticklabels( lob_tuple )
ax.legend( (rects1[0], rects2[0]), ('G', 'F') )
autolabel(rects1)
autolabel(rects2)

I've tried yerr=None , yerr=0 , but this doesn't work either 我试过yerr=Noneyerr=0 ,但这也不起作用

当我在bar方法中查看时,原来它的autolabel命令执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM