#绘制柱状图
import matplotlib.pyplot as plt
import numpy as np
x=[1,2,3,4,5,6]
y=[3,4,5,6,7,8]
c=np.mean(y)
plt.bar(x,y,color="red",hatch="/",tick_label=["q","er","jjd","dd","kk","dd"])
plt.xlabel("x-axis",fontsize=15)
plt.ylabel("y-axis",fontsize=15)
plt.title("bar",fontsize=15)
plt.axhline(y=c,color="blue")
plt.show()
转载于:https://www.cnblogs.com/shunguo/p/11397105.html