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()

python可视化---柱状图_第1张图片

转载于:https://www.cnblogs.com/czz0508/p/10456230.html

你可能感兴趣的:(python可视化---柱状图)