python可视化---柱状图

import matplotlib.pyplot as plt
import matplotlib as mpl

mpl.rcParams["font.sans-serif"] = ["SimHei"]
mpl.rcParams["axes.unicode_minus"] = False

x = [1, 2, 3, 4, 5]
y = [6, 10, 4, 5, 1]

plt.bar(x, y, align="center", color="b", tick_label=["A", "B", "C", "D", "E"], alpha=0.6)

plt.xlabel("测试难度")
plt.ylabel("试卷份数")

plt.grid(True, axis="y", ls=":", color="r", alpha=0.3)

plt.show()

posted @ 2019-03-01 14:31  车路历程  阅读(870)  评论(0编辑  收藏  举报