Matplotlib库

箱线图boxplot——展示数据的分布

https://www.cnblogs.com/wyy1480/p/9526264.html


#https://blog.csdn.net/weixin_42969619/article/details/97141055
#bar

import matplotlib.pyplot as plt
X = [0.3, 1.7, 4, 6, 7]
height = [5, 20, 15, 25, 10]

plt.bar(X, height, width=0.6, bottom=[10, 0, 5, 0, 5] )
plt.show()


#barh
#https://www.jianshu.com/p/d103917cd4811

import matplotlib.pyplot as plt

y=[1,2,3,4,5]#给出在y轴上的位置
width=[5,4,7,2,9]#给出具体每个直方图的数值
label=['car','train','subway','bike','plane']#直方图信息
plt.barh(y,width,facecolor='tan',height=0.5,edgecolor='r',alpha=0.6,tick_label=label)#绘制水平直方图
plt.title('The way people choose to travel')
plt.show()#显示图像

 

你可能感兴趣的:(python)