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

Original


Source: Visual Capitalist (2023)


Objective and Target Audience

As mentioned in the top right corner of the Visual Capitalist (2023) visual, the primary objective of this visual is to find U.S. States that contributed most towards America’s mineral production value in 2022. Apart from this, the visual highlights insights from Southern and Western States and mentions top producers of gold, silver, copper and lithium. The target audience for this visual is the mining industry, in particular, the mining companies.

Visual Issues

The visualization chosen has the following three main issues:

  • Issue 1 - Hard to rank states :
    • Although vertical bars with ranks on the top are provided, the bars are not arranged in ascending or descending order to get a sense of the top performing states conveniently. This visual demands an effort to figure out the top and bottom ranked States by the value of mineral production.
    • Solution - Add ranked (sorted) Bar chart chart next to map. Add mineral production value per state to tooltip.
  • Issue 2 - Author is hiding eastern States :
    • The curved form of the map clutters the eastern States more than the western States. This intentional or unintentional form of scaling (cluttering) can be regarded as a form of deception especially when we note that most of the eastern states are ranked 35+. In other words, the author perceives bias towards south-western states than north-eastern states by curving the map. Also, it is hard to read data on the map due to the curved map, especially for the north-eastern states.
    • Solution - Use a flat map with tooltip. Tooltip helps remove visual clutter.
  • Issue 3: Bad color scheme used for “Top 5 States Percentage of total” and otherwise :
    • The “Top 5 States Percentage of total” visual below the US map uses a bad color scheme. No gradient is maintained to highlight first rank more than the fifth rank. Instead, opposite of this is done. The 5th ranked state, Minnesota stands out the most as Arizona and Nevada almost blend in with the background. Due to the same reason, the mineral production value per state is hard to read. Also, the highlighting of Arizona and Nevada in the text boxes goes unnoticed due to the colors used.
    • Solution - Choose better color scheme. Add percentage contribution per state, which is displayed in “Top 5 States Percentage of total” of original visual to tooltip.

Reference to original visual

Code

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

# Adding 
library(ggplot2) # For plotting map and bar chart
library(ggiraph) # For Interactive plots (added tooltips)
library(dplyr) # For data manipulation
library(patchwork) # For arranging plots on the plot canvas
library(tidyverse) # For data manipulation
library(albersusa) # For US map 
library(ggtext) # For element_markdown() used for alignment
library(ggpubr) # For ggarrange() used for combining plots on canvas (similar to faceting)
library("cowplot") # For ggdraw()

# install.packages("remotes")
# remotes::install_github("hrbrmstr/albersusa", build_vignettes = TRUE)

# Create USGS (2023) in R
Minerals <- data.frame (
                        States = c("Arizona" ,"Nevada" ,"Texas" ,"California" ,"Minnesota" ,"Alaska" ,"Florida" ,"Utah" ,"Michigan" ,"Missouri" ,"Wyoming" ,"Georgia" ,"Pennsylvania" ,"Ohio" ,"New York"  ,"Tennessee" ,"Alabama" ,"North Carolina" ,"Colorado" ,"Wisconsin" ,"Montana" ,"Virginia" ,"South Carolina" ,"New Mexico" ,"Illinois" ,"Indiana" ,"Kansas" ,"Kentucky" ,"Arkansas" ,"Oklahoma" ,"Louisiana" ,"Washington" ,"Idaho" ,"Iowa" ,"Maryland" ,"Oregon" ,"South Dakota" ,"New Jersey" ,"Nebraska" ,"West Virginia" ,"Massachusetts" ,"Mississippi" ,"Connecticut" ,"Hawaii" ,"New Hampshire" ,"Vermont" ,"Maine","North Dakota" ,"Rhode Island" ,"Delaware"),
                        Values = c(10100 ,8930 ,8030 ,5610 ,4780 ,4510 ,2810 ,3600 ,3360 ,3150 ,2480 ,2320 ,2060 ,1490 ,1950 ,1940 ,1920 ,1900 ,1870 ,1720 ,1600 ,1530 ,1160 ,1470 ,1250 ,1380 ,1170 ,806    ,1100 ,1030 ,1030 ,901 ,371 ,846 ,414 ,693 ,475 ,425 ,256 ,204 ,206 ,225 ,194 ,156 ,135 ,136 ,100 ,105 ,88 ,25),
                        Rank = c(1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 ,16 ,17 ,18 ,19 ,20 ,21 ,22 ,23 ,24 ,25 ,26 ,27 ,28 ,29 ,30 ,31 ,32 ,33 ,34 ,35 ,36 ,37 ,38 ,39 ,40 ,41 ,42 ,43 ,44 ,45  ,46 ,47 ,48 ,49 ,50))
# Remove trailing spaces in States column
Minerals$States <- str_trim(Minerals$States, "right")

# Create a percentage column showing each State's contribution to the nation's total
Minerals <- Minerals %>% mutate(Percentage=paste0(round(Values/sum(Values)*100,1),"%"))

# Create new column for tooltip
Minerals <- Minerals %>% mutate(tooltip_text = paste0(toupper(Minerals$States), "\n","$ ", formatC(Minerals$Values, format="d", big.mark=","), "\n", Minerals$Percentage))

# Create the bar chart 
bar_plot <- ggplot(Minerals, aes(x = reorder(Minerals$States, Minerals$Values), y = Minerals$Values,
                     tooltip = Minerals$tooltip_text, data_id = Minerals$States)) + 
  geom_col_interactive(color = "grey", fill = "#0072b2", size = 0.5) + 
  theme_minimal() +
  theme(axis.text = element_text(size = 12), 
        legend.position = "none",
        plot.caption = element_markdown(lineheight = 1.2),
        plot.title = element_textbox_simple(
          hjust = 0,
          vjust = 0,
          size = 15,
          padding = margin(5.5, 5.5, 5.5, 5.5),
          margin = margin(0, 0, 5.5, 0)
        )) + 
  scale_y_continuous(label = scales::dollar_format()) +
  labs(title = "<b>US States Ranked By Mineral Production Value (2022)</b>",
       caption = "<span style = 'font-size:12pt'> <br>**Arizona** made up more than 10% of U.S. mineral production value, and is the leading<br> copper-producing state making up around 70% of domestic copper production <br> <br> 
       **Nevada** remains the nation's top producer of gold and silver,<br> along with being the only lithium-producing state</span>") +
  ylab("USD in Mil. $") + 
  xlab("") +
  coord_flip()

# Get US state data 
us_sf <- usa_sf("lcc") %>% 
  mutate(State = as.character(name))

# Join Our Minerals df with US map df 
Map_data <- left_join(us_sf, Minerals, by = c("State" = "States" ), keep = TRUE)

# Create map plot
map_plot <- ggplot() + 
  geom_sf_interactive(data = Map_data, size =0.125, aes(fill = NULL,data_id = State, tooltip = tooltip_text), color = "white") + 
  #ggtitle("US States Ranked By Mineral Production Value (2022)")+
  theme_void() + 
  theme(legend.position = "none", plot.title = element_text(hjust = 0.5, vjust = 1)) +
  labs(title = "<span style = 'font-size:11pt'>   The **Western region** of the US<br>   accounted for more than<br>   **one-third** of US minerals<br>   production value at $35.9 billion </span>",
    caption = "<span style = 'font-size:12pt'> The **Southern Region** was the top<br> producer of industrial minerals<br> with a value of $13.2 billion </span>") +
  theme(
    plot.caption = element_markdown(lineheight = 1.2),
    plot.title.position = "plot", 
    plot.title = element_textbox_simple(lineheight = 0.8,      size = 13,
                                        padding = margin(5.5, 5.5, 5.5, 5.5),
                                        margin = margin(0, 0, 5.5, 0),)
  )

# Draw bar plot and map plot on same canvas 
figure2 <- ggdraw() +
  draw_plot(map_plot, x = 0, y = .25, width = .45, height = .6)+
  draw_plot(bar_plot, x = .45, y = 0.01, width = .55, height = 0.99)

# Interactive bar chart and US map
p <- girafe(ggobj = figure2, 
       options = list(
         opts_hover(css = ''),
         opts_hover_inv(css = "opacity:0.5;"), 
         opts_sizing(rescale = FALSE)
       ),
       height_svg = 11,
       width_svg = 14) %>% 
  girafe_options(opts_hover(css = "fill:cyan;"))

Data Reference

  • USGS (U.S. Geological Survey) (2023). MINERAL COMMODITY SUMMARIES 2023, USGS Publications Repository Website, accessed 27 April 2023. https://pubs.usgs.gov/periodicals/mcs2023/mcs2023.pdf, pages 10-11, Table 3.—Value of Non-fuel Mineral Production in the United States and Principal Non-fuel Mineral Commodities Produced in 2022

Reconstruction

The following plot fixes the main issues in the original. Please hover over the bars of bar chart or states on US map to view tooltip.