使用 matplotlib 的条形图上不需要的标签
Unwanted labels on bar plot with matplotlib
尽管我尝试通过设置 yerr=None 来删除它们,但我的所有条形图都为零,但我仍然遇到同样的问题。条形图否则正确绘制。如何删除每个条上方打印的 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)
我试过yerr=None
、yerr=0
,但这也不行
结果是 autolabel
命令在我查看 bar 方法时执行此操作。
尽管我尝试通过设置 yerr=None 来删除它们,但我的所有条形图都为零,但我仍然遇到同样的问题。条形图否则正确绘制。如何删除每个条上方打印的 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)
我试过yerr=None
、yerr=0
,但这也不行
结果是 autolabel
命令在我查看 bar 方法时执行此操作。