Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.
Objective
Gun Violence Archive (GVA) documents incident of gun violence and gun crime in the United States of America to provide independent, verified data to those who need to use it in their research, advocacy or writing. The objective of the visualisation is to show the number of incidents occured this year(2019).
The visualisation chosen had the following three main issues:
Reference
The following code was used to fix the issues identified in the original.
# Libraries required
library(readr)
library(magrittr)
library(dplyr)
library(ggplot2)
# Importing the data
Gun <- read_csv("Gun Violence USA 2019.csv")
# Making the data suitable to plot
Gun_2 <- aggregate(cbind(Killed,Injured)~State, data = Gun, FUN = sum)
Gun_2$Casualties <- Gun_2$Killed + Gun_2$Injured
Gun_2$State <- Gun_2$State %>% factor(levels = Gun_2$State[order(-Gun_2$Casualties)])
# Plotting
plot1 <- ggplot(Gun_2, aes(x = Gun_2$State, y = Gun_2$Casualties))
plot1 <- plot1 + geom_bar(stat="identity", fill = "Red") + theme_minimal() + theme(axis.text.x=element_text(angle=90,hjust=1)) +
labs(title = "Gun Violence Casualties in U.S.A January - September 2019",
y = "Number of Casualties",
x = "States") +
geom_text(aes(label=Casualties), vjust = -0.5,size = 3)
Data Reference
The following plot fixes the main issues in the original.