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

Original


Source: DannyDorling.org. Illustration by Kristen McClure @orpheuscat.


Objective

The objective of the visual is to explain mortality in seven countries attributed to COVID - 19.

The visualisation chosen had the following three main issues:

  • On the very first look at the visual, it looks very messy as there is a lot of information shown in it. The way the lines for every country emerges, it doesn’t pleases the eye of the user. It gets messier towards the bottom of the graph.

  • Secondly, the time labels in the plot are not understandable. It could always be challenging to data for each day of the time frame. Time is being picked up randomly, no fixed set of gap or ratio defined between the two time frames.

  • Lastly, there are a lot of comments on the plot itself, which doesn’t makes it clean. I mean a lot of information is already being represented in the plot, therefore comments can be added separately and definitely not needed in the plotting area.

Reference

Code

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

#Load the packages
library(readxl)
library(ggplot2)
library(tidyr)
library(readr)

data <- read_xlsx("C:/Users/hp/Desktop/data/Dataset.xlsx") #Loading the data
data<- data[,c(-1)] #Removed the first column
is.na(data) #Check for NA values in the dataset "data".
data$Country<- as.factor(data$Country)  #Check for Categorical variable

#Plotting Time vs Average number of deaths per day
a<-ggplot(data, aes(x=Time, y=Y, color = Country,label= round(X,digits = 0))) +
   geom_point(size=1)+
   geom_text(hjust = -0.2, nudge_x = 0.05, size =2.5,check_overlap = TRUE,aes(colour = factor(Country)))
p<- a + labs(y = "Average number of deaths per day", title = "Assignment 2", subtitle = "Submitted by: Mehak Gupta (s3931990)",caption = "The labels in the graph represents Increase/Decrease in number of deaths per day")

Data Reference

Reconstruction

The following plot fixes the main issues in the original.