码迷,mamicode.com
首页 > 其他好文 > 详细

kaggle科比投篮数据集的画图案例

时间:2018-07-09 11:05:30      阅读:526      评论:0      收藏:0      [点我收藏+]

标签:nbsp   elf   sel   several   games   画图   max   idt   ogr   

引用地址:https://www.kaggle.com/selfishgene/psychology-of-a-professional-athlete

# plot the shot attempts as a function of time (from start of game) with several different binnings
plt.rcParams[figure.figsize] = (16, 16)
plt.rcParams[font.size] = 16

binsSizes = [24,12,6]

plt.figure();
for k, binSizeInSeconds in enumerate(binsSizes):
    timeBins = np.arange(0,60*(4*12+3*5),binSizeInSeconds)+0.01
    attemptsAsFunctionOfTime, b = np.histogram(data[secondsFromGameStart], bins=timeBins)     
    
    maxHeight = max(attemptsAsFunctionOfTime) + 30
    barWidth = 0.999*(timeBins[1]-timeBins[0])
    plt.subplot(len(binsSizes),1,k+1); 
    plt.bar(timeBins[:-1],attemptsAsFunctionOfTime, align=edge, width=barWidth); plt.title(str(binSizeInSeconds) +  second time bins)
    plt.vlines(x=[0,12*60,2*12*60,3*12*60,4*12*60,4*12*60+5*60,4*12*60+2*5*60,4*12*60+3*5*60], ymin=0,ymax=maxHeight, colors=r)
    plt.xlim((-20,3200)); plt.ylim((0,maxHeight)); plt.ylabel(attempts)
plt.xlabel(time [seconds from start of game])

技术分享图片

 

kaggle科比投篮数据集的画图案例

标签:nbsp   elf   sel   several   games   画图   max   idt   ogr   

原文地址:https://www.cnblogs.com/figo-studypath/p/9282214.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!