热线电话:13121318867

登录
2020-03-12 阅读量: 1278
python:柱状图设置显示数字标签
x = ['北京', '上海', '广州', '深圳', '杭州', '成都', '武汉', '南京', '西安', '厦门']
y = [20000, 19800, 17000, 17000, 15000, 10000, 10000, 9800, 7000, 8000]
plt.figure(figsize=(8, 6), dpi=70)
for i in range(len(x)):
plt.bar(x[i], y[i], color = plt.cm.tab20(i/10))

for i in list(zip(x, y)):
plt.text(i[0], i[1]+300, i[1], horizontalalignment='center')
plt.show();

33.7190
1
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子