当我绘制水平条形图时,当我手动设置yaxis时,我看到在x轴和y轴上都缺少一个图例,如下所示。
bar_locations = np.arange(6)
ax.barh(bar_locations, data ,alpha=.5)
bar_locations = np.arange(6)
# data = [55, 22, 40, 56, 109, 180]
# labels = ['others', u'Belts', u'Apparel & Accessories > Jewelry', u'Jewelry', u'Fragrances', u'Watches']
ax.barh(bar_locations, data ,alpha=.5)
ax.set_yticklabels(labels)
fig.tight_layout()
您还需要设置刻度位置
ax.set_yticks(bar_locations)
ax.set_yticklabels(labels)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句