The original is strong in its visual components and ability to convey a strong message. It is really easy to look at and understand what is happening. A few shortcomings that I found include the color scheme, the axis scales, and a lack of title and some labels. Specifically, as we discussed in class, this may be a difficult color palette for someone with reduced color vision to interpret. With all similar colors, the wrong message may be picked up if someone does not perceive a difference in the given colors. The y axis scale has some room for improvement too. While I appreciate the idea of showing shape, specifically for “charges” and “convictions” in 2018 and onward, this scale doesn’t make it as obvious as it should be the huge disparity between those variables and “killings.” Compressing the scale as is done here loses this message. Finally, a title and y-axis label would help to provide some clarity and context to the reader.
police_violence <- read.csv("https://policyviz.com/wp-content/uploads/2021/05/exploring-the-mapping-police-violence-dataset.csv")
library(ggplot2)
ggplot(police_violence, aes(x = Year)) +
geom_line(aes(y = Killings, color = "Killings")) +
geom_line(aes(y = Charges, color = "Charges")) +
geom_line(aes(y = Convictions, color = "Convictions")) +
geom_point(aes(y = Killings, color = "Killings")) +
geom_point(aes(y = Charges, color = "Charges")) +
geom_point(aes(y = Convictions, color = "Convictions")) +
scale_y_log10()+
scale_color_manual(
values = c("Killings" = "darkred", "Charges" = "red", "Convictions" = "orange"),
breaks = c("Killings", "Charges", "Convictions")
) +
labs(
x = "Year",
y = " ",
color = NULL
) +
theme_minimal()+
theme(
legend.position = "top"
)
I took what I saw as room for improvement in the original graph and altered it here. To start, I adjusted the colors to be more friendly for viewers who have color-vision impairment. Using the viridis color palette, as discussed in class, helps in this. These colors are very different from each other, as well as being better for color-blind people specifically. Next, I changed the scale. As mentioned above, I felt that the true story was not being fully conveyed (a topic we covered greatly in class and in the readings of chapter 17), and I wanted to emphasize how much “killings” was above the other two variables. By changing the scale, I was able to show this difference, while still keeping a bit of a sense of shape in the lower lines. Next, I added direct labeling instead of a legend. This could help to eliminate any confusion or mistakes that may take place when reading the color key or distinguishing between colors. Finally, I added a title and y-axis label, which I hope helps the reader understand more of the context and provide some clarity so they can fully understand what they are looking at.
library(ggplot2)
library(viridis)
## Loading required package: viridisLite
viridis_colors <- viridis(3)
ggplot(police_violence, aes(x = Year)) +
geom_line(aes(y = Killings, color = "Killings")) +
geom_line(aes(y = Charges, color = "Charges")) +
geom_line(aes(y = Convictions, color = "Convictions")) +
geom_point(aes(y = Killings, color = "Killings")) +
geom_point(aes(y = Charges, color = "Charges")) +
geom_point(aes(y = Convictions, color = "Convictions")) +
scale_y_sqrt()+
scale_color_manual(values = c("Killings" = viridis_colors[2],
"Charges" = viridis_colors[3],
"Convictions" = viridis_colors[1]))+
labs(
title = "Police Violence and Repercussions",
x = "Year",
y = "Count",
color = "Police Violence in Recent Years"
) + # Legend title
theme_minimal() +
theme(
legend.position = "none"
) +
annotate("text", x = max(police_violence$Year)-.3, y = tail(police_violence$Killings, 1)+100,
label = "Killings", color = viridis_colors[2], size = 4,hjust = 0) +
annotate("text", x = max(police_violence$Year) -.4, y = tail(police_violence$Charges, 1)+20,
label = "Charges", color = viridis_colors[3], size = 4,hjust = 0) +
annotate("text", x = max(police_violence$Year) - .7 , y = tail(police_violence$Convictions, 1)+4,
label = "Convictions", color = viridis_colors[1], size = 4, hjust = 0)