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()
    
    关注公众号 海量干货等你
  • 相关阅读:
    sort exam
    一个简单的爬虫
    php双色球
    计算水果的总价格
    jquery三级导航,级联菜单精简
    判断学生成绩
    服务器信息展示
    服务器信息(二)一些常量名和时间戳的简单了解
    天气预报ajax+php(可惜用的是已经失效的api)
    mysql基础(二)
  • 原文地址:https://www.cnblogs.com/sowhat1412/p/12734291.html
Copyright © 2011-2022 走看看