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:
Reference
The following code was used to fix the issues identified in the original.
library(ggplot2)
library(dplyr)
# Reading the data from csv file
road_accident<- read.csv("C:/Users/aad19/Documents/Archita/Road_Accidents.csv")
# Flitering the data for year 2000 to 2017
road_accident_2000_2017<-road_accident %>% filter(road_accident$Years>=2000)
# Changing the column names
names(road_accident_2000_2017)[names(road_accident_2000_2017)=="Total.Number.of.Persons.Injured..in.numbers."] <- "Total Number of Persons Injured (in numbers)"
names(road_accident_2000_2017)[names(road_accident_2000_2017)=="Number.of.Persons.Injured.per.Lakh.Population"] <- "Number of Persons Injured (Per Lakh Population)"
# Converting int to factor datatype for Years
road_accident_2000_2017$Years <- factor(road_accident_2000_2017$Years,levels = road_accident_2000_2017$Years)
# To prevent scientic notation
options(scipen = 999)
# Persons Injured in Road Accidents in India from 2000 to 2017
plot_1 <- ggplot(data = road_accident_2000_2017, aes(group = 1, x = `Years`,y = `Total Number of Persons Injured (in numbers)` ))
plot_1 <- plot_1 + geom_line(stat = "identity", colour = "MAROON") + geom_point(colour = "MAROON") +
labs(title = "Persons Injured in Road Accidents in India from 2000 to 2017",
y="Number of Persons Injured (in numbers)")+
theme(plot.title = element_text(face = "bold",size = 10, hjust = 0.5))+ scale_y_continuous(limits = c(350000,550000))
# Persons Injured (Per Lakh Population) in India from 2000 to 2017
plot_2 <- ggplot(data = road_accident_2000_2017, aes(group = 1, x = `Years`,y = `Number of Persons Injured (Per Lakh Population)` ))
plot_2 <- plot_2 + geom_line(stat = "identity", colour = "CYAN") + geom_point(colour = "CYAN") +
labs(title = "Persons Injured (Per Lakh) in India from 2000 to 2017",
y="Number of Persons Injured (Per Lakh)")+
theme(plot.title = element_text(face = "bold",size = 10, hjust = 0.5))+ scale_y_continuous(limits = c(36,46))
Data Reference
The following plot fixes the main issues in the original.