Skip navigation

(FWIW I think I even caused myself pain due to the title of this blog post).

Kaiser Fung (@junkcharts) did a makeover post on this chart about U.S. steel tariffs:

Kaiser’s makeover is good (Note: just because I said “good” does not mean I’m endorsing the use of pie charts):

But, I’m curious as to what others would do with the data. Here’s my stab at a single-geom makeover:

library(waffle)
library(viridis)
library(tidyverse)

data_frame(
  country = c("Rest of World", "Canada*", "Brazil*", "South Korea", "Mexico", 
              "Russia", "Turkey", "Japan", "Taiwan", "Germany", "India"),
  pct = c(22, 16, 13, 10, 9, 9, 7, 5, 4, 3, 2)
) %>% 
  mutate(country = sprintf("%s (%s%%)", country, pct)) %>% 
  waffle(
    colors = c("gray70", viridis_pal(option = "plasma")(10))
  ) +
  labs(
    title = "U.S. Steel Imports — YTD 2017 Percent of Volume",
    subtitle = "Ten nations account for ~80% of U.S. steel imports.",
    caption = "Source: IHS Global Trade Atlas • YTD through September 2017\n* Canada & Brazil are not impacted by the proposed tariffs"
  ) +
  theme_ipsum_ps() +
  theme(legend.position = "top") +
  theme(axis.text = element_blank()) +
  theme(title = element_text(hjust=0.5)) +
  theme(plot.title = element_text(hjust=0.5)) +
  theme(plot.subtitle = element_text(hjust=0.5)) +
  theme(plot.caption = element_text(hjust=1))

The percentages are included in the legend titles in the event that some readers of the chart may want to know the specific numbers, but my feeling for the intent of the original pac-man pies was to provide a list that didn’t include China-proper (despite 45 using them to rile up his base) and give a sense of proportion for the “top 10”. The waffle chart isn’t perfect for it, but it is one option.

How would you use the data (provided in the R snippet) to communicate the message you think needs to be communicated? Drop a note in the comments with a link to your creation(s) if you do give the data a spin.

10 Comments

  1. It is hard to see separation between countries, maybe qualitative palettes work better? colors = c("gray70", brewer.pal(10, "Paired"))

  2. Honestly,

    I would just use the right side of the Fung plot above, and then simply re-title the plot to what it shows. The title on either pie chart would work fine. This would be better than a title for the plot that states the conclusion to be drawn. That can be in the text, or in a caption to the plot. I think that is the most straight forward, informative solution. But thank you for another approach.

  3. When I copied and pasted the code into RStudio on a Win 10 pc I got the error ” (list) object cannot be coerced to type ‘double’ “

  4. since the point of the graphic is to spike a political bray, which graphic one uses doesn’t matter much. the only change for any would be to explicitly list China. FWIW.

  5. and, according to reporting, it’s Mexico not Brazil that get the other exemption. until Dear Leader changes his mind.

  6. Hi, this looks really great. However, when I run the code in RStudio it returns an error saying that the “object cannot be coerced to type ‘double'”. Seems that waffle cannot handle the data.frame. Any suggestions? Thanks a lot, Matthias

    • Sorry, my Ad-blocker blocked other comments, so I didn’t see that there was already a comment on this further above. I posted my sessionInfo() in the gist. Thanks!

  7. Of all the three graphs, the waffle graph is the worst way to present this data. Like pie graphs, the waffle graph also makes comparison of different units difficult. Particularly on this example. Even if you manage to understand which country is which color, the colors are so similar that it’s impossible to tell them apart. So please don’t do this.

    • You’re welcome to your opinion. As you can see, others have disagreed with said opine. What makeover did you put out there for others to opine on?


2 Trackbacks/Pingbacks

  1. […] This is a Security Bloggers Network syndicated blog post authored by hrbrmstr. Read the original post at: rud.is […]

  2. […] article was first published on R – rud.is, and kindly contributed to […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.