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

Original


Source: US: Department of Treasury 2022.


Objective

The original visualization created by Joyce Ma is a great piece that aims to illustrate the amount of US treasury debt that is owned by foreign investors per country. This debt, in the form of treasury bonds, amounts to a considerable 7.3 trillion USD. The visual contains almost 40 individual nations that hold US debt aswell as an ‘other’ category. Accompanying the visual is an article giving some specific facts about the topic; China’s holdings have decreased 30% in the last year and how the US dollar has strengthened in the same time. Dorothy Neufeld, the author of the article posted this on the popular site visualcapitalist.com. Her goal i think was to describe the phenomenon from a less technical viewpoint and to stimulate the conversation with some theory s. The website visualcapitalist is a media site that has a library of articles on a range of topics; politics, markets, technology and healthcare to just name a few. It’s a very user friendly website aiming to present potentially complicated information to curious people. The audience of this particular visualization could range from educated economists to your curious teenager wanting to learn about world-wide markets.

While the visualization I chose was very good, i noticed three areas that could at least be improved to provide a more detailed story:

  • Due to it’s ‘pie chart’ like nature, it’s hard to compare sizes of various segments.
  • There is a lot of bright colour that doesn’t do a great job of separating into different continents.
  • Only a single value per instance doesn’t show much of a trend, there is potential for showing multiple variables and incorporating much more into the story.

Reference

Code

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

library(readxl)
library(magrittr)
library(dplyr)
library(ggplot2)
library(GGally)
library(plotly)
library(forcats)

debt<- read_excel('C:/Users/Danie/OneDrive/Documents/uni/2023/sem1/DataVis/assignment2/us_treasury_bonds.xlsx', col_names = TRUE, col_types = NULL, skip = 0)

colnames(debt)[1] <- 'Countries'
colnames(debt)[2] <- '2022-01-01'
colnames(debt)[3] <- '2022-02-01'
colnames(debt)[4] <- '2022-03-01'
colnames(debt)[5] <- '2022-04-01'
colnames(debt)[6] <- '2022-05-01'
colnames(debt)[7] <- '2022-06-01'
colnames(debt)[8] <- '2022-07-01'
colnames(debt)[9] <- '2022-08-01'
colnames(debt)[10] <- '2022-09-01'
colnames(debt)[11] <- '2022-10-01'
colnames(debt)[12] <- '2022-11-01'
colnames(debt)[13] <- '2022-12-01'
colnames(debt)[14] <- 'Current_Debt'


debt <- debt[!(debt$Countries == "Australia" | debt$Countries == "Grand Total" |debt$Countries == "All Other"),]

############ plotting #################
debt$change <- (((debt$Current_Debt)-(debt$`2022-01-01`))/(debt$`2022-01-01`))*100
debt$continent <- c(
  'Asia',
  'Asia',
  'Europe',
  'Europe',
  'Europe',
  'Europe',
  'North America',
  'North America',
  'Europe',
  'Asia',
  'Asia',
  'Asia',
  'South America',
  'Asia',
  'Europe',
  'Asia',
  'Asia',
  'Europe',
  'Europe',
  'North America',
  'Europe',
  'Asia',
  'North America',
  'Asia',
  'Asia',
  'Asia',
  'Asia',
  'Asia',
  'Europe',
  'Europe',
  'Europe',
  'South America',
  'Europe',
  'North America',
  'Asia',
  'South America',
  'South America'
)


p1 <- ggplot(data = debt, aes(x = Current_Debt, y = reorder(Countries, Current_Debt), fill = change)) + 
  geom_bar(stat = 'identity', width = 0.8) +
  scale_fill_gradient(low = "blue", high = 'red') +
  facet_wrap(~ continent, nrow = 4, scales = "free_y", strip.position = 'left') +
  labs(x = "Current Debt owned (billions $)", y = "Country", title = "Foreign holders of US Treasury Debt - Jan 2023",
       fill = "% Change from Jan 22")

Data Reference

Reconstruction

The following plot fixes the main issues in the original.

I faceted the continents so it would be much clearer which continents had large amounts of debt. Separating into a bar chart made it easier to compare debt values at the same time the colour shows the percentage change in the data, which countries have sold large proportions over the last year and which ones are buying up more.