Original



Objective

This visualisation is generated by a China tourism website. And the objective of this data visualisation is to present to the audience on the air quality index in China, Beijing. This visualisation aims to show the audience the AQI changes in Beijing from 2015 to 2018, as well as to show the improvement in AQI over the years.

The visualisation chosen had the following three main issues:

  • The choice of colour of the pie charts could be improved. In particular, the colour of orange and red are very similar which causes problems for audiences who are colour blind.

  • Pie charts relies on area-size comparison between the air quality index each year, which will make it harder for audience to do comparison on data slices. This may slow down the process for viewers to analyse and assimilate the information of this visualisation.

  • The labels on the pie chart’s text size is too small and hard to be read.

Reference https://www.chinadiscovery.com/beijing-tours/weather-seasons/beijing-air-quality.html

Code

#Import Libaries 
library(readr) 
library(ggplot2)
library(gridExtra)

#Read CSV file
aqi <- read_csv("aqi.csv")

#Grouping the AQI Level
aqi$AQI    <-   factor(aqi$AQI,levels=c("Good Days (0-50)","Moderate Days (50-100)","USG Days (100-150)","Unhealthy Days (>150)"))
years <- factor(c("2015", "2016", "2017", "2018"))

#Plotting graphs for each year
plot1 <- ggplot(data = aqi, aes(x = AQI, y = Year_2015, fill = AQI))+
    geom_bar(position="dodge",stat = "identity", width=0.9) + ggtitle("AQI in Year 2015") + labs(y= "Number of Days", x = "Air Quality Index") + scale_fill_manual(values = c("#332288", "#117733", "#DDCC77", "#882255")) + theme(legend.text=element_text(size=6), legend.key.size = unit(0.3, "cm"), axis.text.x = element_text(angle=45, hjust=1), legend.position = "right")
plot2 <- ggplot(data = aqi, aes(x = AQI, y = Year_2016,  fill = AQI))+
    geom_bar(position="dodge",stat = "identity", width= 0.9) + ggtitle("AQI in Year 2016") + labs(y= "Number of Days", x = "Air Quality Index") + scale_fill_manual(values = c("#332288", "#117733", "#DDCC77", "#882255")) + theme(legend.text=element_text(size=6), legend.key.size = unit(0.3, "cm"), axis.text.x = element_text(angle=45, hjust=1), legend.position = "right")
plot3 <- ggplot(data = aqi, aes(x = AQI, y = Year_2017,  fill = AQI))+
    geom_bar(position="dodge",stat = "identity", width=0.9 ) + ggtitle("AQI in Year 2017") + labs(y= "Number of Days", x = "Air Quality Index") + scale_fill_manual(values = c("#332288", "#117733", "#DDCC77", "#882255")) + theme(legend.text=element_text(size=6), legend.key.size = unit(0.3, "cm"), axis.text.x = element_text(angle=45, hjust=1), legend.position = "right")
plot4 <- ggplot(data = aqi, aes(x = AQI, y = Year_2018,  fill = AQI))+
    geom_bar(position="dodge",stat = "identity", width= 0.9) + ggtitle("AQI in Year 2018") + labs(y= "Number of Days", x = "Air Quality Index") + scale_fill_manual(values = c("#332288", "#117733", "#DDCC77", "#882255")) + theme(legend.text=element_text(size=6), legend.key.size = unit(0.3, "cm"), axis.text.x = element_text(angle=45, hjust=1), legend.position = "right") 

Reconstruction