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

Original


Source: Stockholm International Peace Research Institute Military Expenditure Database.


Objective

The primary objective of the visualisation is to present a concise summary of the federal budget of the United States, with a focus on military spending and expected levels of government. Individuals interested in US government policies, economics, military spending, students, and journalists serve as the target audience for this particular visualisation.

The visualisation chosen had the following three main issues:

  • Deceptive methods: Pie charts can be used when the data adds up to 100%. The data in the visualisation that I have used does not add up to 100. Pie charts will display inaccurate proportions when the input data does not add up to 100% and is not in percentage form. Other sorts of charts, such as bar charts can be used to display the data if it is not possible to convert the data into percentages.

  • Perceptual or colour issues: The pie chart is challenging to interpret because some of the countries, including Spain and Russia, as well as some other countries, utilise colours that are similar. Additionally, it can be challenging for people who are red-green colorblind to distinguish between various pie chart segments that use the red and green colours. Confusion can result, and the data may be interpreted incorrectly as a result. Furthermore, if the slices are not proportionate to their true values, the size of each slice may appear to be larger than it is. This can make it challenging to compare the dimensions of several slices in a pie chart effectively.

  • When there are too many categories, pie charts are not a smart option because it can be challenging to distinguish between slices and the chart can end up looking cluttered. Additionally, some countries have very small areas, and the labelling in this visualisation is very confusing. Pie chart slices should be arranged in either ascending or descending order according to their values, but in the visual I picked up, they are not arranged in the right sequence.

These issues can be addressed using a bar chart.

Reference

Code

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

library(ggplot2)
library(magrittr)
library(dplyr)
#Create a dataframe 
military_expenditures <- data.frame(
  country = c("Poland", "Netherlands", "Iran", "Spain", "Turkey", "Israel", "Canada", "Australia", "Italy", "Brazil", "South_Korea", "Japan", "United_Kingdom", "Germany", "France", "Saudi_Arabia", "Russia", "India", "China", "USA", "Rest_of_world"),
  expenditures = c(11.9, 12.1, 12.6, 17.2, 20.4, 20.5, 22.2, 25.9, 26.8, 26.9, 43.9, 47.6, 48.7, 49.3, 50.1, 61.9, 65.1, 71.1, 261.1, 731.8, 241.1)
)
#create a colour vector for each country
colors <- c("#a6cee3", "#1f78b4", "#b2df8a", "#c3d6db", "#fb9a99", 
            "#fccde5", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", 
            "#ffff99", "#b15928", "#d9d9d9", "#8dd3c7", "#bebada", 
            "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#704214", 
            "#000000")
#Create a bar graph with "expenditures" on the x-axis, "country" on the y-axis, coloured by each country. 
military_expenditures <- military_expenditures %>%
  arrange(expenditures) %>% 
  mutate(country = reorder(country, expenditures)) 
p1 <- ggplot(military_expenditures, aes(x = expenditures, y = country)) +
  geom_col(aes(fill = country)) +  
  scale_fill_manual(values = colors) +
  geom_text(aes(label = scales::comma(expenditures), hjust = -0.1), color = "black", size = 3.5) +
  scale_x_continuous(expand = c(0,0), labels = scales::comma_format(), 
                     breaks = seq(0, 800, by = 100), 
                     limits = c(0,800))+
  theme_minimal() +
  labs(title = "Military Expenditures by Country (US$ billions,2019)",
       x = "Expenditures (in billions USD)",
       y = "Country",
       caption = "Source: Stockholm International Peace Research
                   Institute Military Expenditure Database. ") +
  theme(plot.title = element_text(hjust = 0.5, size = 14, face = "bold"),
        axis.title.x = element_text(size = 12, margin = margin(t = 8)),
        axis.text = element_text(size = 10),
        axis.ticks = element_blank())

Data Reference

Reconstruction

The following plot fixes the main issues in the original.