Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.
Objective
The visualisation chosen had the following three main issues:
There is inconsistancies in the graph, with the last four numbers in the bar chart showing ‘336’.
The visualisation is not not use a colour blind friendly pallette. Also the lower numbers in the graph have a redish colour representing danger while the higher numbers have greenish colours representing potitivity. In reality, mass shootings are not a good thing at all, let alone a high number of them.
The graph is presented in a bar-chart form, as it goes over time, it should be done in lineplot form.
Reference
The following code was used to fix the issues identified in the original.
# generate packages
library(ggplot2)
library(readxl)
library(grid)
library(ggthemr)
# Create the data for the chart
Year <- c(2014, 2015, 2016, 2017, 2018, 2019, 2020)
`Total Mass Shootings` <- c(269, 385, 383, 346, 336, 417, 617)
data <- data.frame(Year, `Total Mass Shootings`)
print(data)
## Year Total.Mass.Shootings
## 1 2014 269
## 2 2015 385
## 3 2016 383
## 4 2017 346
## 5 2018 336
## 6 2019 417
## 7 2020 617
# plot data
ggthemr('grape')
p <- ggplot(data = data, aes(x= Year, y=`Total Mass Shootings`, group = 1)) +
geom_line(size = 1.2, alpha = 0.9) + geom_point(size = 3)
p <- p + geom_text(aes(label = `Total Mass Shootings`), size = 4, vjust = -2)
p <- p + ylim(0,800)
p <- p + labs(title = "Number of Mass Shootings per From 2014 to 2020",
subtitle = "(At least 4 people affected)",
caption = "Data source: https://www.gunviolencearchive.org/",
size = 2)
Data Reference
Gunviolencearchive.org. 2022. Gun Violence Archive. [online] Available at: https://www.gunviolencearchive.org/ [Accessed 30 April 2022].
The following plot fixes the main issues in the original.