相信大部分球迷到现在也认为这是一个假新闻吧,Fake News!
今天的推文用到的数据来自kaggle ,推文的大部分内容是来自 https://www.kaggle.com/xvivancos/kobe-bryant-shot-selection/report
第一步读入数据shots<-read.csv("Kobe/data.csv",header=T)查看数据维度dim(shots)

数据集总共有25个变量,今天的推文重点关注的是

  • combined_shot_type 出手类型

  • shot_zone_range 出手距离

  • shot_zone_area 出手区域

  • shot_zone_basic 这个也是出手区域

出手类型总共有6种
  • Jump Shot 跳投

  • Dunk 扣篮

  • Layup 上篮

  • Tip Shot 补篮

  • Hook Shot 勾手

  • Bank Shot 擦板

这里遇到一个疑问:为啥擦板也算一种投篮类型呢?有没有人知道呢?
通过柱形图来看一下不同的出手方式大小排序df1<-data.frame(table(shots$combined_shot_type))df1library(ggplot2)ggplot(df1,aes(x=reorder(Var1,Freq),y=Freq))+geom_col(aes(fill=Var1))+geom_label(aes(label=Freq))+coord_flip()+theme_bw()+theme(axis.title = element_blank(),axis.ticks.x=element_blank(),axis.text.x = element_blank(),legend.position = "none")
打开网易新闻 查看精彩图片
image.png
通过上图我们可以看出科比几乎所有的进攻都会选择跳投
接下来看一下出手距离

出手距离划分为

  • Less Than 8 ft

  • 8-16 ft

  • 16-24 ft

  • 24+ ft

  • Back Court Shot

这里一个小知识点是

feet 英尺;1英尺等于0.3048米 NBA三分线7.25米;23.9英尺
library(tidyverse)library(cowplot)p1<-ggplot(shots,aes(x=lon,y=lat))+geom_point(aes(color=shot_zone_range),show.legend = F)+ylim(c(33.7,34.0883))+theme_void()

p2<-ggplot(shots,aes(x=fct_infreq(shot_zone_range)))+
geom_bar(aes(fill=shot_zone_range),show.legend = F)+
theme_bw()+
labs(x=NULL,y=NULL)
plot_grid(p1,p2,ncol = 1,nrow = 2)

打开网易新闻 查看精彩图片
image.png 接下来是出手区域,出手区域划分为

  • 左右底角

p3<-ggplot(shots,aes(x=lon,y=lat))+geom_point(aes(color=shot_zone_area),show.legend = F)+theme_void()+ylim(c(33.7,34.0883))p3p4<-ggplot(shots,aes(x=fct_infreq(shot_zone_area)))+geom_bar(aes(fill=shot_zone_area),show.legend = F)+theme_bw()+labs(x=NULL,y=NULL)+theme(axis.text.x = element_text(angle=60,hjust=1))p4plot_grid(p3,p4,ncol = 1,nrow = 2)
打开网易新闻 查看精彩图片
image.png