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

Original


Source: Article from HowMuch.net (2018).


Objective

The main objective of the visualisation is to show the difference in military budget of countries in the year 2017. Here the United States is seen to be the biggest spender on their military followed by China, Saudi Arabia, and Russia. The size of the area represents the percentage of total worldwide spending while colour expresses the percentage of spending against national GDP.

The target audience are policy makers, politicians, government officials, military personnel, and the general public who are looking to compare countries’ military budgets and military spending as per GDP.

The visualisation chosen had the following three main issues:

Visually difficult to compare: The piechart makes it difficult if not impossible to make accurate comparison of each countries’ spending as the area for each country is all lumped into a single visualisation without any common indicator to make comparisons. Instead, the audience are forced to read and compare the numeric values.

Wrong choice of colour: The colour representing the military spending as a percentage of national GDP is unintuitive as the red shades are hard to distinguish with scales that are not consistent. For example, 3.1% to 4.3% and then 10%. Also, the colour scale used is unfavorable for audience who are colour blind.

Misleading data labels and title: On each area there are percentage labels that are not clearly explained what they represent and could be easily confused with the legend on the bottom right. Furthermore, the title “The World’s Spending on War” is highly misleading for audience as this visualisation represents the military budget. Lastly, countries at the bottom of the visualisation such as Turkey and Canada has a much smaller font than the rest.

Reference

Code

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

library(ggplot2)
library(readr)
library(tidyverse)

budget1 <- read_csv("second.csv", n_max = 16)

p1 <- ggplot(budget1, aes(x = Spending, y = reorder(Country, -Spending))) + geom_bar(stat = "identity") + 
  scale_fill_brewer() + 
  theme(axis.text.x = element_text(face="bold", size=10),
        axis.text.y = element_text(size=12, face="italic"),
        axis.title.y = element_text(face="bold"),
        plot.title = element_text(size=15),
        panel.background = element_rect(color = "black",fill = "white"),
        panel.grid.major.y = element_line(color = "grey"),
        panel.grid.major.x = element_blank(),
        legend.position = "none") + 
  labs(title="Countries spending on Military in Billions",
       x = "Spending in Billions ($)",
       y = "") +
  geom_text(aes(label = Spending),nudge_x = 23) +
  scale_x_continuous(expand = c(0, 0),limits = c(0, 660), labels=scales::dollar_format())

p2 <- ggplot(budget1, aes(x = `% of World share`, y = reorder(Country, -`% of World share`)), label = scales::percent(prop.table(stat(count)))) + geom_bar(stat = "identity") + 
  scale_fill_brewer() + 
  theme(axis.text.x = element_text(face="bold", size=10),
        axis.text.y = element_text(size=12, face="italic"),
        axis.title.y = element_text(face="bold"),
        plot.title = element_text(hjust=1, size=15),
        panel.background = element_rect(color = "black",fill = "white"),
        panel.grid.major.y = element_line(color = "grey"),
        panel.grid.major.x = element_blank(),
        legend.position = "none") + 
  labs(title="Countries spending as a Percentage of Worldwide Military Spending",
       x = "Percentage share of Worldwide Spending (%)",
       y = "") +
  geom_text(aes(x=`% of World share`, label = scales::percent(`% of World share`/100, accuracy=0.01)), nudge_x = 2.5) +
  scale_x_continuous(expand = c(0, 0), limits = c(0, 42), labels= function(x) paste0(x, "%"))

p3 <- ggplot(budget1, aes(x = `% of GDP`, y = reorder(Country, -`% of GDP`)), label = scales::percent(prop.table(stat(count)))) + geom_bar(stat = "identity") + 
  scale_fill_brewer() + 
  theme(axis.text.x = element_text(face="bold", size=10),
        axis.text.y = element_text(size=12, face="italic"),
        axis.title.y = element_text(face="bold"),
        plot.title = element_text(size=15, hjust=0.8),
        panel.background = element_rect(color = "black",fill = "white"),
        panel.grid.major.y = element_line(color = "grey"),
        panel.grid.major.x = element_blank(),
        legend.position = "none") + 
  labs(title="Countries spending as a Percentage of National GDP",
       x = "Military Spending as percentage of National GDP (%)",
       y = "",
       caption="Source: Stockholm International Peace Research Institute (SIPRI) 2017") +
  geom_text(aes(x=`% of GDP`, label = scales::percent(`% of GDP`/100, accuracy=0.01)), nudge_x = 0.6) +
  scale_x_continuous(expand = c(0, 0), limits = c(0, 11.5), labels= function(x) paste0(x, "%"))

Data Reference

Reconstruction

The following plot fixes the main issues in the original.