League of Legends 數(shù)據(jù)分析小項(xiàng)目

image.png

這是我的第一個(gè)數(shù)據(jù)小項(xiàng)目化焕,(期中考試陸陸續(xù)續(xù)寫(xiě)了一點(diǎn),不過(guò)都跟猴子搬玉米似的惕稻,第二次繼續(xù)寫(xiě)又不連貫了险绘,所以考完在圖書(shū)館蹲了一天總算是把它shut down了 :))那啥,如果有做的不好的地方還請(qǐng)各位見(jiàn)諒坛善,畢竟新手,哈哈。
因?yàn)樵氖窃趉aggle上寫(xiě)的,用的英文吗蚌,就暫時(shí)不翻譯過(guò)來(lái)了(對(duì)了,數(shù)據(jù)來(lái)自于kaggle數(shù)據(jù)集 League of Legends.有關(guān)于數(shù)據(jù)集的介紹就不贅述了纯出。


image.png

分割線


  • Hello everyone, this is a data analysis demo of League Of Legends (LOL) competitions. As an 5 years old LOLer I appreciate the pleasure that this game bring us so much. And this is the reason why I choose LOL as my first project.
  • Therefore, I try my best to use what I have learned to complete in this demo, although it seems not good QAQ,cause I'm a rookie. So if there are some problems in my demo. Plaese give me some comments or guidences,thanks! (PS: RNG fighting in MSI ! :)

Then I will display it from 5 aspects:

  • Bans
  • Number of leagues
  • Gamelength
  • Kills
  • Monsters and structures

Bans


library(tidyverse)
library(RColorBrewer)
library(dplyr)
library(grid)
library(gridExtra)
options(warn = -1)
bans <- read.csv("../input/bans.csv")
head(bans)
image.png
  • reshape the data
bans <- bans[,-1]
newbans <- bans %>% tbl_df() %>% gather(.,ban_1,ban_2,ban_3,ban_4,ban_5,key = "ban_num",value = "heros") %>% filter(.,heros != "")
head(newbans)
image.png
  • visualization
ggplot(newbans,aes(x=heros,fill=heros))+geom_histogram(stat = "count",binwidth = 20)+coord_flip()+theme(legend.position = "none")+
  facet_wrap(facets = ~Team,scales = "free")
Rplot01.jpeg

we can get some info from this picture.

  • Leblanc,shen,Syndra are most banned heroes in blue Team.
  • Leblanc,Kalista,Zac are most banned heroes in red Team

Numeber of games per League of Legends






leagues <- read.csv("../input/LeagueofLegends.csv")
test <- leagues %>% select(.,League,Year,Season) %>% filter(League == c("MSI","NALCS","LMS","LCK","EULCS")) %>%
  group_by(League,Year) %>% summarise(number = n())
m <- c(RColorBrewer::brewer.pal(12,"Set3"),brewer.pal(3,"Set2"))
z1 <- ggplot(test,aes(x=Year,y = number,fill=League))+geom_histogram(stat = "identity",position = "stack")+
  scale_fill_manual(values = m)+theme(legend.position = "none")
z2 <- ggplot(test,aes(x=reorder(League,-number),y = number,fill=League))+geom_bar(stat = "identity")+scale_fill_manual(values = m)+
  labs(x="League",y="Number of Competitions")+theme(legend.position = "top",legend.text  = element_text(size = 5))
grid.arrange(z1,z2,ncol=2)

image.png

Eh~ In this part, I only choose 5 main Leagues from the data, and I wonder why this data doesn't have LPL competitons? Maybe our country's walls. So we can get some info that LCK league has most competition and NALCS second. But if LPL in data , I think it may have more competitions than NALCS

newleagues <- mutate(leagues,seatype = str_c(leagues$Season,leagues$Type))
newleagues %>% group_by(League,Year,seatype) %>% summarise(number=n()) %>% ggplot(aes(Year,y = League,size  = number,color =seatype))+
  geom_point()+facet_wrap(~seatype)+theme(legend.position = "top",axis.text.y = element_text(size = 8),legend.text=element_text(size=5),legend.key.size = unit(.2, "cm"))
image.png

Compare gamelength in different leagues


p <- leagues %>% select(League,gamelength) %>% filter(League == c("MSI","NALCS","LMS","LCK","EULCS"))
ggplot(p,aes(x = gamelength,colour = League))+geom_density()
image.png
ggplot(p,aes(x = gamelength,fill=League))+geom_density()+facet_wrap(~League)
image.png
ggplot(p,aes(x = League,y = gamelength,fill = League))+geom_boxplot()
image.png
  • we can find that diffrenet leagues' gamelength distributions are similar in general. Most games length end in 30 ~40 min, but there are some interesting phenomenons. For example: MSI gamelength has a rise during 50~60 min .Besides, LCK and NALCS have longest game in total and MSI has most short gamelength.( ps: I'm curious about why NALCS have similar gamelength with LCK, cause in my previous cognition,NALCS always has fast pace of the game 0_0 )

Kills


kills <- read.csv("../input/kills.csv")
#choose my favorite players from the data
players <- c("Faker","Doublelift","Uzi","Rekkles","PraY")
kills %>% mutate(Player = word(kills$Kille,-1)) %>% select(Time,Player) %>% filter(Player %in% players) %>%
ggplot(aes(x =Time,fill= Player))+geom_density(alpha = 0.7)+facet_wrap(~Player,nrow = 5)
image.png

I choose 4 ADCs in 2018 MSI League.(PraY,Rekkles,Uzi,Doublelift) and a so famous person in LOL -faker,then I found almost players start to get Kills from 15 minutes . Before this time, they farmed in themselves' line. And 20~30 min become a most bellicose time to most teams.

Monsters and Structures


monsters <- read.csv("../input/monsters.csv")
monsters  %>% ggplot(aes(x = Type,y =Time,fill=Type))+geom_violin()+coord_flip()+
theme(legend.position = "top",legend.text = element_text(size=8))
image.png
dragon_name <- c("AIR_DRAGON","EARTH_DRAGON","FIRE_DRAGON","WATER_DRAGON")
p1 <- monsters %>% filter(Type == dragon_name) %>% ggplot(aes(x = Type,fill=Type))+geom_histogram(stat = "count")+scale_fill_brewer(4,"Set3")+
theme(legend.position = "top")
p2  <- monsters %>% filter(Type != dragon_name) %>% ggplot(aes(x = Type,fill=Type))+geom_histogram(stat = "count")+scale_fill_brewer(3,"Set3")+
theme(legend.position="top")+coord_flip()
grid.arrange(p1,p2)
image.png
  • The picture tell us that amount of 4 diffrent element dragons are equal(alright~, I admit that AIR_DRAGON amount seems a little lack than others )
  • Besides we can also find that FIRE_DRAGON is most popular dragon in teams. And a strange point is that most ELDER_DRAGON was killed when it borns or minutes later.
structures <- read.csv("../input/structures.csv")
structures %>% na.omit() %>% mutate(NewTeam = str_sub(Team,1,1)) %>% 
ggplot(aes(Time,colour = NewTeam))+geom_density()+facet_wrap(~Type)+scale_color_manual(values = c("blue","red"),labels = c("blue","red"),name = "Team")+labs(title = "The time distribution of different teams destroy structures")
image.png
  • Don’t you find some special point in the line chart?--yes! Blue win rate seems that more than red especially in 20~35 min and it shows similar phenomenon on other towers.

something I want to say ...


  • At last ,thanks anyway if you read my whole analysis project. If my poor English expression ability or worst code writting method give you some uncomfortable experience, please tell us , I'm so glad to change these bad points.
  • Finally,I get some sparks and refers from the kernel Jonathan Bouchet LOL games : 4 years of esport,thanks so much!
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末蚯妇,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子暂筝,更是在濱河造成了極大的恐慌箩言,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,284評(píng)論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件焕襟,死亡現(xiàn)場(chǎng)離奇詭異陨收,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)鸵赖,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,115評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門(mén)务漩,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人卫漫,你說(shuō)我怎么就攤上這事∩錾埃” “怎么了列赎?”我有些...
    開(kāi)封第一講書(shū)人閱讀 164,614評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我包吝,道長(zhǎng)饼煞,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,671評(píng)論 1 293
  • 正文 為了忘掉前任诗越,我火速辦了婚禮砖瞧,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘嚷狞。我一直安慰自己块促,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,699評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布床未。 她就那樣靜靜地躺著竭翠,像睡著了一般。 火紅的嫁衣襯著肌膚如雪薇搁。 梳的紋絲不亂的頭發(fā)上斋扰,一...
    開(kāi)封第一講書(shū)人閱讀 51,562評(píng)論 1 305
  • 那天,我揣著相機(jī)與錄音啃洋,去河邊找鬼传货。 笑死,一個(gè)胖子當(dāng)著我的面吹牛宏娄,可吹牛的內(nèi)容都是我干的问裕。 我是一名探鬼主播,決...
    沈念sama閱讀 40,309評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼绝编,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼僻澎!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起十饥,我...
    開(kāi)封第一講書(shū)人閱讀 39,223評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤窟勃,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后逗堵,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體秉氧,經(jīng)...
    沈念sama閱讀 45,668評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,859評(píng)論 3 336
  • 正文 我和宋清朗相戀三年蜒秤,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了汁咏。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 39,981評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡作媚,死狀恐怖攘滩,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情纸泡,我是刑警寧澤漂问,帶...
    沈念sama閱讀 35,705評(píng)論 5 347
  • 正文 年R本政府宣布,位于F島的核電站,受9級(jí)特大地震影響蚤假,放射性物質(zhì)發(fā)生泄漏栏饮。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,310評(píng)論 3 330
  • 文/蒙蒙 一磷仰、第九天 我趴在偏房一處隱蔽的房頂上張望袍嬉。 院中可真熱鬧,春花似錦灶平、人聲如沸伺通。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,904評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)泵殴。三九已至,卻和暖如春拼苍,著一層夾襖步出監(jiān)牢的瞬間笑诅,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,023評(píng)論 1 270
  • 我被黑心中介騙來(lái)泰國(guó)打工疮鲫, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留吆你,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,146評(píng)論 3 370
  • 正文 我出身青樓俊犯,卻偏偏與公主長(zhǎng)得像妇多,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子燕侠,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,933評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容