Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.
Objective Different light have different wavelength
and thus lights with higher wavelength travel further. This is important
when drivers shares road with the cyclists and particularly to
understand which colour is better visible to the drivers during night
time. This data visiualization created aims to portray the proportion of
visibility of cyclists wearing different colours of clothing to drivers
in vehicle during night time. This visualisation is created targeting
both drivers and cyclists who shares roads together.
However, the visualisation chosen had the following three main
issues:
Reference
reddit. 2022. Visibility in Traffic. [online] Available at: https://www.reddit.com/r/dataisugly/comments/u12f1c/visibility_in_traffic/ [Accessed 2 May 2022].
The following code was used to fix the issues identified in the original.
library(ggplot2)
library(dplyr)
##data
Lights = c("Black", "BLue", "Red", "Yellow", "White", "Green")
Vision = c(0, 55, 79, 121, 180, 426)
Visibility <- data.frame(Lights,Vision)
p1<-ggplot(Visibility, aes(x = reorder(Lights, Vision), y = Vision)) +
#plotting bars
geom_bar(stat = "identity", aes(fill = factor(Vision))) +
#colouring each bars with their equivalent visiblity colour
scale_fill_manual(values = c('black', 'blue', 'red',
'yellow', 'white', 'green')) +
##adding sub text into bars and hence removing legend
geom_text(aes(label = Vision), vjust = 0) + guides(fill = FALSE) +
##removing background noise
theme(
plot.background = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank()
) +
##labelling the bar chart
xlab("colours") + ylab("Visibility Range (ft)") + labs(title = " Different colour visiblity to drivers",)
Data Reference
The following plot fixes the main issues in the original.