players <- read_csv("ipl2026_players.csv")
players <- as_tibble(players)
fig1_data <- players %>%
arrange(desc(AuctionPrice)) %>%
slice(1:20)
ggplot(fig1_data, aes(x = reorder(PlayerName, AuctionPrice),
y = AuctionPrice, fill = Team)) +
geom_bar(stat = "identity") +
coord_flip()
fig2_data <- players %>%
group_by(Team, Role) %>%
summarise(TotalSalary = sum(AuctionPrice, na.rm = TRUE), .groups = "drop")
ggplot(fig2_data, aes(x = Team, y = TotalSalary, fill = Role)) +
geom_bar(stat = "identity")
fig3_data <- players %>%
filter(Role %in% c("Batsman", "All-Rounder"))
p <- ggplot(fig3_data, aes(x = AuctionPrice, y = RunsScored,
color = Team)) +
geom_point()
ggplotly(p)
fig4_data <- players %>%
group_by(Team, Nationality) %>%
summarise(AverageSalary = mean(AuctionPrice, na.rm = TRUE), .groups = "drop") %>%
pivot_wider(names_from = Nationality, values_from = AverageSalary)
ggplot(fig4_data, aes(y = Team)) +
geom_point(aes(x = India)) +
geom_point(aes(x = Overseas)) +
geom_segment(aes(x = India, xend = Overseas, yend = Team))
ggplot(players %>% filter(!is.na(StrikeRate)),
aes(x = StrikeRate, fill = Role)) +
geom_density(alpha = 0.4)
fig6_data <- players %>%
arrange(desc(WicketsTaken)) %>%
slice(1:20)
ggplot(fig6_data, aes(x = reorder(PlayerName, WicketsTaken),
y = WicketsTaken)) +
geom_col() +
coord_flip()
fig7_data <- players %>%
group_by(Team, Role) %>%
summarise(Count = n(), .groups = "drop")
ggplot(fig7_data, aes(x = Team, y = Role, fill = Count)) +
geom_tile()