标签: python matplotlib
我是matplotlib的新手。我试图制作一个简单的条形图,但是似乎无法使轴与条形图对齐。我尝试了多种宽度组合,但是我确定我遗漏了一些东西。
labels, values = zip(*charfarm.items()) indexes = np.arange(len(labels)) width = 0.8 plt.bar(indexes, values, width) plt.xticks(indexes + width, labels) plt.show()
Graph
答案 0 :(得分:1)
由于您在#There is no deemphasize, having which saves a considerable amount of time. 函数中进行了indexes + width操作,因此您的价格变动被抵消了。
#There is no deemphasize, having which saves a considerable amount of time.
indexes + width
请参考以下代码:
plt.xticks