pyplot、柱状图、显示数据、python

1.很简单哦

# x = ['M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'M8', 'M9', 'M10', 'M11', 'M12', 'M13']
# y = [0, 1, 0, 0, 1, 1, 6, 13, 11, 3, 2, 4, 0]
x = motifs_count.keys()
y = motifs_count.values()

plt.bar(x, y)
# 循环,为每个柱形添加文本标注,居中对齐
for xx, yy in zip(x, y):
    plt.text(xx, yy + 0.1, str(yy), ha='center')
plt.show()

2.结果

猜你喜欢

转载自blog.csdn.net/a_cherry_blossoms/article/details/114705488