Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.
Objective
The visual I have chosen is from Income Inequality article by Max Roser and Esteban Ortiz-Ospina. The graph shows the distribution of income shares amongst the highest earners in the country. The objective of the visualization is to show the percentage of country’s wealth going to the top 10% of income earners. The visual is intended for general audience however people with an interest in the finance would be more interested in the visual.
The visualisation chosen had the following three main issues:
Reference
The following code was used to fix the issues identified in the original.
library(dplyr)
library(ggplot2)
library(knitr)
data <- read.csv("income-share-of-the-top-10-pip.csv",header=TRUE)
latestdata <-data %>%
group_by(Entity) %>%
summarise_at(vars(Share.of.the.richest.decile.in.total.income.or.expenditure), list(Avg_share_of_richest_decile_in_total_income = mean))
top50percent<- latestdata %>% slice_max(Avg_share_of_richest_decile_in_total_income, prop = 0.5)
bottom50percent<- latestdata %>% slice_min(Avg_share_of_richest_decile_in_total_income, prop = 0.5)
plot1<-ggplot(data=top50percent, aes(x=Avg_share_of_richest_decile_in_total_income, y=reorder(Entity,Avg_share_of_richest_decile_in_total_income))) +
geom_bar(colour="#D41159", stat="identity")+
labs(x="Average Share of richest 10% in Country's Income",y="Country")+
theme(text = element_text(size = 5), element_line(size = 0.1)) +
ggtitle("Top Countries with Average share of richest decile in Total Country Income")
plot2<-ggplot(data=bottom50percent, aes(x=Avg_share_of_richest_decile_in_total_income, y=reorder(Entity,Avg_share_of_richest_decile_in_total_income))) +
geom_bar(colour="#1A85FF", stat="identity")+
labs(x="Average Share of richest 10% in Country's Income",y="Country")+
theme(text = element_text(size = 5), element_line(size = 0.1)) +
ggtitle("Bottom Countries with Average share of richest decile in Total Country Income")
Data Reference
The following plot fixes the main issues in the original.