ggplot(wow_battlegrouds_final, aes(x = Faction)) +
geom_bar(aes(fill = Faction), stat = "count") +
geom_text(aes(label = paste(round(after_stat(count), 0),
" (", round(..count../sum(..count..)*100, 1), "%)", sep = "")),
stat = "count", vjust = 1.1, position = position_stack(vjust = 1.1)) +
scale_fill_manual(values = c("Alliance" = "blue", "Horde" = "red"))
## Warning: The dot-dot notation (`..count..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(count)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
ggplot(wow_battlegrouds_final)+
geom_bar(mapping = aes(x=Class, fill = Class))+
geom_text(mapping = aes(x=Class,y=..count..,label = ..count..)
,stat = "count",vjust=1.1)+
scale_fill_manual(values = c( "Death Knight" = "red",
"Demon Hunter" = "darkmagenta",
"Druid" = "orange",
"Hunter" = "green",
"Mage" = "skyblue",
"Monk" = "springgreen",
"Paladin" = "pink",
"Priest" = "white",
"Rogue" = "yellow",
"Shaman" = "blue",
"Warlock" = "purple",
"Warrior" = "tan"))+
theme(axis.text.x = element_text(angle = 45, hjust = 1))
wow_battlegrouds_final %>%
count(Class, Rol) %>%
ggplot(aes(x = Rol, y = n, fill = Class)) +
geom_col(position = "stack") +
geom_text(aes(x = Rol, y = n, label = n),
position = position_stack(vjust = 0.5), color = "black", size = 3) +
scale_fill_manual(values = c(
"Death Knight" = "red",
"Demon Hunter" = "darkmagenta",
"Druid" = "orange",
"Hunter" = "green",
"Mage" = "skyblue",
"Monk" = "springgreen",
"Paladin" = "pink",
"Priest" = "white",
"Rogue" = "yellow",
"Shaman" = "blue",
"Warlock" = "purple",
"Warrior" = "tan"
)) +
labs(title = "Roles y Clases", x = "Rol", y = "Conteo")
#### Veremos una tabla con la distribución de clases por la horda
## # A tibble: 12 × 12
## Class AB BG DG ES SA SM SS TK TP WG Total
## <chr> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <dbl>
## 1 Death Knig… 22 57 11 44 14 30 8 40 27 54 307
## 2 Demon Hunt… 19 53 10 42 8 39 11 61 28 59 330
## 3 Druid 38 53 12 38 28 52 12 55 31 62 381
## 4 Hunter 23 59 10 36 19 57 16 28 40 63 351
## 5 Mage 35 62 17 44 15 46 12 67 36 48 382
## 6 Monk 24 14 8 18 7 26 5 25 14 34 175
## 7 Paladin 34 62 17 30 12 49 15 38 35 64 356
## 8 Priest 38 47 12 49 17 61 13 38 45 64 384
## 9 Rogue 49 82 13 44 8 46 9 63 32 36 382
## 10 Shaman 64 115 20 55 26 112 20 98 76 120 706
## 11 Warlock 26 69 6 29 21 64 12 57 35 64 383
## 12 Warrior 30 79 12 34 15 55 6 77 42 92 442
## # A tibble: 12 × 12
## Class AB BG DG ES SA SM SS TK TP WG Total
## <chr> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <dbl>
## 1 Death Knig… 19 41 7 21 13 40 10 36 26 50 263
## 2 Demon Hunt… 21 59 7 51 7 50 3 48 40 54 340
## 3 Druid 48 90 26 63 22 85 17 75 47 78 551
## 4 Hunter 35 78 14 46 16 86 16 53 52 77 473
## 5 Mage 46 61 16 28 24 54 17 71 43 72 432
## 6 Monk 24 36 3 27 11 29 4 29 23 38 224
## 7 Paladin 33 81 16 36 20 66 17 82 37 66 454
## 8 Priest 41 49 18 30 17 60 18 31 42 79 385
## 9 Rogue 29 46 6 35 16 48 6 56 40 74 356
## 10 Shaman 30 45 17 36 14 36 8 38 20 34 278
## 11 Warlock 25 56 10 26 15 31 13 48 31 58 313
## 12 Warrior 48 80 10 54 20 48 11 69 47 74 461
ggplot(wow_battlegrouds_final, aes(x = Class, fill = Class)) +
geom_bar(mapping = aes(x = Class, fill = Class)) +
geom_text(mapping = aes(x = Class, y = ..count.., label = ..count..),
stat = "count", vjust = 1) +
facet_wrap(~ Faction) +
scale_fill_manual(values = c(
"Death Knight" = "red",
"Demon Hunter" = "darkmagenta",
"Druid" = "orange",
"Hunter" = "green",
"Mage" = "skyblue",
"Monk" = "springgreen",
"Paladin" = "pink",
"Priest" = "white",
"Rogue" = "yellow",
"Shaman" = "blue",
"Warlock" = "purple",
"Warrior" = "tan"
)) +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
wow_battlegrouds_final %>%
count(Faction, Rol, Class) %>%
ggplot(aes(x = Faction, y = n, fill = Class)) +
geom_col(position = "stack") +
geom_text(aes(x = Faction, y = n, label = n),
position = position_stack(vjust = 0.5), color = "black", size = 3) +
facet_wrap(~ Rol) +
scale_fill_manual(values = c(
"Death Knight" = "red",
"Demon Hunter" = "darkmagenta",
"Druid" = "orange",
"Hunter" = "green",
"Mage" = "skyblue",
"Monk" = "springgreen",
"Paladin" = "pink",
"Priest" = "white",
"Rogue" = "yellow",
"Shaman" = "blue",
"Warlock" = "purple",
"Warrior" = "tan"
)) +
labs(title = "Facciones, Roles y Clases", x = "Facción", y = "Conteo")
AB = Arathi basin BG = Battle for Gilneas DG = Deepwind Gorge ES = Eye of the storm SA = Strand of the Acients SM = Silvershard Mines SS = Seething shore TK = Temple of Kotmogu TP = Twin Peaks WG = Warsong Gulch
wow_battlegrouds_final %>%
group_by(Faction, Battleground) %>%
summarise(tasa_victoria = sum(Win) / n() * 100,.groups = "drop_last") %>%
ggplot(aes(x = Battleground, y = tasa_victoria, fill = Faction)) +
geom_col(position = "dodge") +
geom_text(aes(label = paste0(round(tasa_victoria), "%")),
position = position_dodge(width = 1), vjust = -0.5) +
scale_fill_manual(labels = c("Alianza", "Horda"), values = c("blue", "red")) +
labs(title = "Tasa de victoria por facción y mapa", x = "Mapa",
y = "Tasa de victoria (%)", fill = "Facción") +
theme_classic()
wow_battlegrouds_final %>%
filter(Faction == "Horde" & Win == 1) %>%
summarise(tasa_victoria_promedio = n() / nrow(filter(wow_battlegrouds_final,
Faction == "Horde"))) * 100
## tasa_victoria_promedio
## 1 64.79581
wow_battlegrouds_final %>%
filter(Faction == "Alliance" & Win == 1) %>%
summarise(tasa_victoria_promedio = n() / nrow(filter(wow_battlegrouds_final,
Faction == "Alliance"))) * 100
## tasa_victoria_promedio
## 1 36.31347
wow_battlegrouds_final %>%
group_by(Faction, Battleground) %>%
summarise(tasa_derrota = sum(Lose) / n() * 100,.groups = "drop_last") %>%
ggplot(aes(x = Battleground, y = tasa_derrota, fill = Faction)) +
geom_col(position = "dodge") +
geom_text(aes(label = paste0(round(tasa_derrota), "%")),
position = position_dodge(width = 1), vjust = -0.5) +
scale_fill_manual(labels = c("Alianza", "Horda"), values = c("blue", "red")) +
labs(title = "Tasa de derrota por facción y mapa", x = "Mapa",
y = "Tasa de Derrota (%)", fill = "Facción") +
theme_classic()
wow_battlegrouds_final %>%
filter(Faction == "Horde" & Lose == 1) %>%
summarise(tasa_derrota_promedio = n() / nrow(filter(wow_battlegrouds_final,
Faction == "Horde"))) * 100
## tasa_derrota_promedio
## 1 35.20419
wow_battlegrouds_final %>%
filter(Faction == "Alliance" & Lose == 1) %>%
summarise(tasa_derrota_promedio = n() / nrow(filter(wow_battlegrouds_final,
Faction == "Alliance"))) * 100
## tasa_derrota_promedio
## 1 63.68653