Original tab includes original visualisation and critique, Code tab for process taken for reconstructed visualisation and Reconstruction presents the completed visualisation and displays resolves critiques.
Objective
The objective of the original visualisation is to display the top countries that China exports the largest value to. This is calculated by total USD within a given year.
The visualisation chosen had the following three main concerns: NOTE: These concerns are resolved within the reconstructed visualisation.
Target Audience
The target audience for this visualisation includes the following:
Reference
Figure 1: HowMuch.net, 2020, China’s Biggest Exports - Total value of China’s Exports by Country,HowMuch.Net,viewed 2 April 2022 https://howmuch.net/articles/chinas-exports-imports-trade-balance
The following code was used to fix the issues identified in the original visualisation.
#The original data that was used was sourced.
library(readxl)
library(dplyr)
Exports <- read_excel("~/Visualisation & Communication/Assessment 2/Exports_to_Counterpart_Countries- China.xlsx",
skip = 5)
colnames(Exports)[colnames(Exports) == "...1"] <- "Country"
colnames(Exports)[colnames(Exports) == "2018"] <- "Total"
sapply(Exports,class)
## Country Total 2019 2020 2021
## "character" "numeric" "numeric" "numeric" "numeric"
#Values are represented in simpler form
Exports[2:5] <-Exports[2:5] * 1000000
#These categories had been used in the original visualisation
Exports2 <- Exports %>% mutate(Category = case_when(`Total` >= 100000000000 ~ "> $100B", Total > 50000000000 & Total < 99900000000 ~ "$50B - $99.9B", Total > 10000000000 & Total < 49900000000 ~ "$10B - $49.9B", Total > 1000000000 & Total < 9990000000 ~ "$1B - $9.9B"))
#The top 50 countries with highest import values from China was selected for increased readability. No countries under the value of $1 billion USD had been considered in original visualisation.
Exports2 <- na.omit(Exports2)
Exports3 <- Exports2[order(Exports2$Total, decreasing = TRUE),]
Exports3 <- Exports3[1:50, ]
#Continents are mentioned in the explanation of the original visualization as well as use of a map, so this was important to include.
continents <- read_excel("~/Visualisation & Communication/Assessment 2/continents.xlsx")
Exports3 <- merge(Exports3,continents, by = "Country")
#ordering the factor variables assists with the display of the visualisation and increased readibility
Exports3$Category <- factor(Exports3$Category, order = TRUE,
levels = c("> $100B", "$50B - $99.9B", "$10B - $49.9B", "$1B - $9.9B"))
Exports3$Continent <- factor(Exports3$Continent, order = TRUE,
levels = c("Africa", "Asia", "North America", "South America", "Oceania", "Europe"))
Exports3 <- transform(Exports3, Country = reorder(Country, Total))
#Plotting and design of the visualisation in form of a horizontal bar chart
library(ggplot2)
library(scales)
p1 <- ggplot(data = Exports3, aes(x = Country, y =Total,fill=Continent))
p1 <- p1 + geom_bar(stat="identity", color="#7A7A7A") + coord_flip()
p1 <- p1 + scale_y_continuous(labels = label_number(suffix ="B", scale = 1e-9))
#Colors selected are color-blindness friendly
p1 <- p1 + facet_grid(rows = vars(Category), scales="free_y", space="free_y", switch = "y") + scale_fill_manual(values=c('#d73027','#fc8d59','#fee090','#e0f3f8','#91bfdb','#4575b4'))
#Values are rounded and 'B' added for ease of interpretation.
p1 <- p1 + geom_text(aes(label = paste(round(Total / 1e9, 1), "B"), hjust = -0.1))
#The exact location within China (Mainland) noted inline with the data source. Year also added in subtitle.
p1 <- p1 + labs(y="Total value of Exports - USD",
title = "China's Biggest Trade Countries - Exports",
subtitle = "Exports from China PR:Mainland, 2018",
caption = "Data source: International Monetary Fund, 2022. Exports FOB to Partner Countries")
p1 <- p1 + theme(strip.text.y = element_text(size = 12, face="bold"),
legend.position = 'top',
plot.title=element_text(size=20, hjust = 0.5, color="#707070", face= "bold"),
plot.subtitle=element_text(size=16, hjust = 0.5, color="#707070"),
plot.caption=element_text(size=10,color="#707070"),
axis.title.x = element_text(size = 12, color ="#707070"),
axis.text.x = element_text(size=12),
axis.text.y = element_text(size=12),
axis.title.y = element_blank(),
panel.background = element_blank())
Data Reference
International Monetary Fund, 2022, Exports, FOB, to Partner Countries - China,PR::Mainland, viewed 2 April 2022, https://data.imf.org/regular.aspx?key=61726508
github.com - dbouqin, 2016, Countries-Continents , viewed 3 April 2022, https://github.com/dbouquin/IS_608/blob/master/NanosatDB_munging/Countries-Continents.csv
The following visualisation resolves the concerns noted via critique of original visualisation.