Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.
Objective
The objective of the visualisation is to show the rise in the abuse of UK Members of Parliament from 2015 to 2017. two datasets have been shown in the graph. Firstly, the proportion of replies which are abusive; has been visualised using the heights of the bars. secondly, the change in the volume of abusive replies between 2015 and 2017 which represented by the width of the bars. the grey colour bars have been used to represent the year 2015; whereas the coloured bars have been used to represent the year 2017 and the parties.
The visualisation chosen had the following three main issues:
Reference
The following code was used to fix the issues identified in the original.
library(ggplot2)
#Define the gender of each bar
male_female <- c("Female", "Female", "Female", "Female", "Female", "Female", "Female", "Female",
"Male", "Male", "Male", "Male", "Male", "Male", "Male", "Male", "Male", "Male", "Male", "Male")
#Define the party of each bar
party <- c("Conservative Party", "Green Party", "Labour Party", "Scottish National Party",
"Conservative Party", "Green Party", "Labour Party", "Scottish National Party",
"Conservative Party", "Democratic Unionist Party", "Labour Party", "Liberal Democrats", "Plaid Cymru", "Scottish National Party",
"Conservative Party", "Democratic Unionist Party", "Labour Party", "Liberal Democrats", "Plaid Cymru", "Scottish National Party")
#Define the year of each bar
years <- c(2015, 2015, 2015, 2015, 2017, 2017, 2017, 2017,
2015, 2015, 2015, 2015, 2015, 2015, 2017, 2017, 2017, 2017, 2017, 2017)
#Define the proportion value of each bar
values <- c(1.75, 0.75, 1.75, 0.6, 4, 1.5, 2.4, 1.9, 5.2, 1.5, 3.9, 3.1, 1.3, 1.5,
6.8, 3.1, 3.5, 4.45, 2, 2)
#Define the Volume above each bar
volume <- c(0.1, 0.2, 0.4, 0.2, 2, 2, 2, 2,
1.2, 0.2, 0.7, 1.2, 1, 2, 2, 2, 2, 2, 2, 1.2)
#create the graph
data_graph <- data.frame(Year = years, Gender = male_female, Party = party, proportion_volume = values)
data_graph$Year <- as.factor(data_graph$Year)
data_graph$PARTY_GENDER <- paste(data_graph$Party, data_graph$Gender)
data_graph$PARTY_YEAR <- paste(data_graph$Party, data_graph$Year)
data_graph$Volume <- volume
#design the graph
corrected_graph_gender <- ggplot(data_graph, aes(x = PARTY_GENDER, y = proportion_volume , fill = Year)) +
geom_bar(stat = "identity", position = "dodge") +
theme_light()+
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
scale_fill_manual(values=c("#E98b56", "#56B4E9")) +
scale_y_continuous(breaks = seq(0, 10, 0.5), labels = paste0(seq(0, 10, 0.5), "%")) +
xlab("Party - Gender") +
ggtitle("The rise of UK MPs abusive replies from 2015 to 2017\n(The proportion of replies which are abusive, and the volume of abusive replies 'from 0 to 2' between 2015 and 2017)")+
geom_text(aes(label=Volume), position=position_dodge(width=0.9), vjust=-0.25)
Data Reference
The data was reconstructed from the original graph manually since it has not available online. Furthermore, the volume of abusive replies has been roughly estimated from the chart.
The following plot fixes the main issues in the original.