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

Original


Source: Visual Capatitalist(2019).


Objective

The obejective of the visualisation was to show the percentage of world debt that countries in the world posess. The unfographic also aims to show visually how the countries debt compares to its GDP. The target audience would be anyone who is interested in the state of global debt along with stakeholders in countries GDPs and the world economy.

The visualisation chosen had the following three main issues:

  • Issue 1 The visualisation is first and formost very cramped. Although the fragmented pie chart shows clearly the contries with a large percentage of the total world debt, it is difficult to understand how other countries with a smaller debt percentage fair. The areas of the pie chart are hard to get an understanding of, this makes it harder to compare information between the countries.

  • Issue 2 The colour choice to visualise the debt to GDP % is unintuiative. The countries with higher debt to gdp ratios were represented with lighter colours which instinctivley is percieved to be good thing. In fact the lighter colours such as yellow are trying to signify very high amounts of debt in countries. This is most aparent with Japan.

  • Issue 3 Due to visualising the data in pie chart form, the countries with small percentages of the world’s total debt are restricted to small areas within the pie chart. Their areas are so small that the display of percentages of world debt are unable to fit within the chart. In some cases the percentage value in omitted alltogether. Country names also clip into other countries areas, which may cause confusion. This happens with Nigeria and South Africa in the top right of the visualisation.

Reference Desjardins, J. (2019). $69 Trillion of World Debt in One Infographic. [online] Visual Capitalist. Available at: https://www.visualcapitalist.com/69-trillion-of-world-debt-in-one-infographic/.

Code

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

library(ggthemes)
library(tidyverse)
library(readxl)
library(ggplot2)
library(widgetframe)
library(ggiraph)
library(sf)
library(sp)
library(colormap)
library(shiny)


mapdata <- read.csv('mapdata.csv')

mapdata$Debt.to.GDP <- mapdata$Debt.to.GDP *100


map1<-ggplot(mapdata, aes(x= long,y=lat, group=group)) +
  geom_polygon(aes(fill = Debt.to.GDP), color= 'Black')

map2 <- map1 +scale_fill_gradient(name = 'Debt as a percentage of GDP',
                                  low = 'chartreuse1',high='red1',na.value = 'grey50')+
  theme(axis.text.x = element_blank(),
        axis.text.y = element_blank(),
        axis.ticks = element_blank(),
        axis.title.y=element_blank(),
        rect=element_blank()) 
map2<- map2 + theme(plot.background = element_rect(fill = 'lightblue'))

names(mapdata)[9] <- 'Debt to GDP (1.0 = 100%)'

mapdata$X..of.World <- mapdata$X..of.World *100


Map2 <- map2 + 
  geom_polygon_interactive(
    aes(long,lat,group=group, fill= mapdata$`Debt to GDP (1.0 = 100%)`,
        tooltip=sprintf("%s<br/>%s",region,X..of.World)))+
  hrbrthemes::theme_ipsum() + scale_fill_gradient(
    low = 'chartreuse1',high='red1',na.value = 'grey50') +
  labs(title = 'Percentage of world Debt by country', 
       subtitle ='Interactive labels display % of total world Debt.',
       fill='Debt as a 
        Percentage of GDP %') + theme(plot.background = element_rect(fill = 'lightblue'))+
  theme(legend.key.size = unit(0.4,'cm'),legend.title = element_text(size = 6,face = 'bold'),legend.text = element_text(size = 6))+                                   
  theme(axis.text.x = element_blank(),
        axis.text.y = element_blank())

P1 <-widgetframe::frameWidget(ggiraph(code=print(Map2)))

Data Reference

  • Data Reference

Desjardins, J. (2019). $69 Trillion of World Debt in One Infographic. [online] Visual Capitalist. Available at: https://www.visualcapitalist.com/69-trillion-of-world-debt-in-one-infographic/.

www.imf.org. (n.d.). https://www.imf.org/external/datamapper/GGXWDG_NGDP@WEO/OEMDC/ADVEC/WEOWORLD. [online] Available at: https://www.imf.org/external/datamapper/GGXWDG_NGDP@WEO/OEMDC/ADVEC/WEOWORLD.

Reconstruction

The following plot fixes the main issues in the original.