python用list中的数据画数据分布直方图

from matplotlib import pyplot as plt

# 参数依次为list,抬头,X轴标签,Y轴标签,XY轴的范围
def draw_hist(myList,Title,Xlabel,Ylabel,Xmin,Xmax,Ymin,Ymax):
    plt.hist(myList,100)
    plt.xlabel(Xlabel)
    plt.xlim(Xmin,Xmax)
    plt.ylabel(Ylabel)
    plt.ylim(Ymin,Ymax)
    plt.title(Title)
    plt.show()


draw_hist(areaList,'AreasList','Area','number',50.0,250,0.0,8)   # 直方图展示
draw_hist(perimeterList,'perimeterList','Area','number',40.0,80,0.0,8)

来自:https://www.cnblogs.com/jerrybaby/p/6118236.html

    原文作者:日常敲代码间歇旅行的程序媛
    原文地址: https://blog.csdn.net/weixin_41079550/article/details/108427535
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞