Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.

Original


Source: road-accidents-persons-killed-and-injured-1970-2017 (2019).


Objective

  • Ministry of Road Transport and Highways, Government of India published this visulisation and data in 2019 under Open Government Data (OGD) Platform. The intension of published visualisation is depict Number of Road Accident accured from 1994 till 2017.
  • The visulaisation is divided in two parts: Bar graph represent Total Number of Road Accident in India and Line graph represent Total Number of Road Accident per Lakh Population from 1994 to 2017.
  • Data was published by Ministry of Road Transport and Highways, Government of India in order to increase awareness of Trafic rules among people of India.

The visualisation chosen had the following three main issues:

  • Incorrect selection of graph :- Here, bar graph is used to represent total number of road accident from 1994 to 2017. In order to represent time series data, line graph might be used.
  • Dual Axis :- The presence of dual axes makes it confusing for the viewers to associate and data manipulation becomes easy with dual axes.
  • Color Blindness :- Protanopes are more likely to confuse with shades of Orange-tinted reds and black.

Reference

Code

The following code was used to fix the issues identified in the original.

library(readr)
library(dplyr)
library(ggplot2)

# Reading the data from csv file
roadAccidentIndia<- read_csv("roadAccidentIndia.csv")

# Flitering the data from Year 1994
roadAccidentIndia <- roadAccidentIndia %>% filter(roadAccidentIndia$Years>=1994)

p1 <- ggplot(roadAccidentIndia,
             aes(x = factor(`Years`),
                 y = `Total Number of Road Accidents (in numbers)`,
                 group = 1 )) +
  ggtitle("Road Accidents in India from 1994 to 2017") +
  xlab("Year") + 
  ylab("Total Number of Road Accidents (in numbers)") +
  geom_line(stat = "identity",size= 1,colour="#396ACB") +
  geom_point(colour="#396ACB") + 
  theme(panel.background = element_rect(fill = "white", colour = "grey50"),
        plot.title = element_text(hjust = 0.5),
        axis.text.x = element_text(size = 7)) +
  scale_y_continuous(limits = c(300000,550000)) 

p2 <- ggplot(roadAccidentIndia,
             aes(x = factor(`Years`),
                 y = `Number of Accidents per Lakh Population`,
                 group = 1)) + 
  ggtitle("Number of Accidents per Lakh Population in India from 1994 to 2017")+
  xlab("Year") + 
  ylab("Number of Accidents per Lakh Population") + 
  geom_line(colour="#CA4E55",size=1) +
  geom_point(colour="#CA4E55") +
  theme(panel.background = element_rect(fill = "white", colour = "grey50"),
        plot.title = element_text(hjust = 0.5),
        axis.text.x = element_text(size = 7)) +
  scale_y_continuous(limits = c(35,45)) 

Data Reference

Reconstruction

The following plot fixes the main issues in the original.