zoukankan      html  css  js  c++  java
  • python 绘图 工具

    import numpy as np
    import matplotlib.pyplot as plt
    slices = 10
    arr = timelist
    density = []
    
    n, bins, patches = plt.hist(arr, bins=slices,  facecolor='g', alpha=0.75)
    print (n)
    print (bins)
    print (patches)
    
    plt.ylabel(u'个数',fontproperties='SimHei')
    plt.xlabel(u'时长(s)',fontproperties='SimHei')
    plt.title(u'得分分布[文件个数:'+str(len(arr))+u']',fontproperties='SimHei')
    
    for i in range(slices):
        density.append("%.2f" % (float(n[i])/len(arr) * 100))
    
    
    for i in range(slices):
        plt.text((bins[i]+bins[i+1])/2, n[i] + 5, str(density[i])+"%", ha='center')
    
    plt.xticks(bins)
    plt.grid(True)
    plt.show()
    
    
    
    
    ===========================================
    
    
    
    import numpy as np
    import matplotlib.pyplot as plt
    slices = 500
    
    n, bins_same, patches = plt.hist([same_score,not_same_score], bins=slices,alpha=1,color=['b','r'],label='same')
    
    plt.ylabel(u'个数',fontproperties='SimHei')
    plt.xlabel(u'得分',fontproperties='SimHei')
    plt.title(u'号码相同跟号码不同得分分布[文件个数:'+str(len(same_score))+u']',fontproperties='SimHei')
    
    plt.xticks([x for x in range(-100,85,5)])
    plt.show()
    
    关注公众号 海量干货等你
  • 相关阅读:
    redis redis-cli 操作指令
    Apache 配置默认编码
    Apache 查找httpd.conf文件
    Apache 错误日志
    dataTable 自定义排序
    bootstrap select2 参数详解
    获取元素滚动条高度
    TP5 操作DB is null is not null 条件
    TP5 自带分页类的传参
    jquery 获取 file 表单 上传的文件名
  • 原文地址:https://www.cnblogs.com/sowhat1412/p/12734291.html
Copyright © 2011-2022 走看看