Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.
Objective This visualization is that of the performance of the batsmen in the World Cup 2015. The visualization was meant for the fans of the game of cricket and a deeper insight into the performance of the top players. The objective of the original visualization was to show the best batsmen in the World Cup 2015 and their respective share of runs in their teams. This visualization does not do justice to it with the pie chart shown above. The mistakes identified from here are:
Reference
The following code was used to fix the issues identified in the original.
library(ggplot2)
cric <- data.frame(Player = c("Williamson","Rohit","Shakib","Warner","Babar","Du Plesis","Pooran","Root",
"Kusal P.","Rahmat S."),
Perc_team_score = c(30.23, 29.05, 28.25, 25.02, 24.51, 21.06, 20.01, 19.07, 18.16,
14.8))
cric <- cric[order(-cric$Perc_team_score),]
cric$Player <- factor(cric$Player, levels = cric$Player[order(-cric$Perc_team_score)])
p1 <- ggplot(data = cric, aes(group=1, x=Player, y=Perc_team_score))
p1 <- p1 + geom_bar(stat = 'identity', colour = "black", fill = "grey") +
geom_text(aes(label = paste(Perc_team_score, "%", sep = '')), nudge_y = 2, nudge_x = 0.05) +
labs(
title = "Players having the highest % of their team's score",
y = "% of team's score") + theme(plot.title = element_text(hjust = 0.5),
panel.background = element_rect(fill = "white", colour = "#6D9EC1",
size = 2, linetype = "solid"),
panel.grid.major = element_line(size = 0.5, linetype = 'solid',
colour = "grey"),
panel.grid.minor = element_line(size = 0.25, linetype = 'solid',
colour = "grey")) +
scale_y_continuous(limits = c(0,35))
** Data Reference**
The following plot fixes the main issues in the original.