matplotlib条形图
程序员文章站
2022-04-21 15:02:46
...
matplotlib条形图
#条形图
import matplotlib as mpl
import matplotlib.pyplot as plt
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.barh(x,y,align="center",color="c",tick_label=["A","B","C","D","E"])
plt.ylabel("难度测试")
plt.xlabel("试卷份数")
plt.grid(True,axis="x",ls=":",color="r",alpha=0.3)
plt.show()