Adapting and Improving Data Visualization

Author

Daniel G

Data Loading

library(tidyverse)
#install.packages("ggforce")
library(ggforce)
europe <- read.csv("playfair_european_nations.csv")
europe$Country <- fct_reorder(europe$Country, europe$Area, .desc = TRUE)

Critique of Playfair Graph

Playfair Graph

Above is the Playfair graph, made by William Playfair and published in his book Statistical Breviary in 1801. In it, he attempts to display the relationships major nations have between each of their area (land size), population, and revenue. Each circle and connected vertical lines represent one nation each, with the nation labelled below. The size of each circle is the nation’s land area (or “extent, as the graph calls it), the red line is the nation’s population, and the yellow line is the nations revenue (in taxes). Overall, it appears as the Playfair wanted mainly to communicate the differences between nations in these aspects, in particular on the relationship between each nation’s population and it’s revenue.

There are two main points that the graph does an excellent job of pointing out when first looking at the graph: differences in land area, and also in highlighting which nation’s appear to have higher rates of taxation proportional to their population. Playfair added a dashed line between the tops of the red and yellow lines, which does a great job of making the eye latch onto which of those dashed lines are increasing and which ones are decreasing. This added dashed-line element also takes up some of the space of the graph, which otherwise is a little sparse. The only weakness I’d point out in this graph would be how it is difficult to fully compare the different nations; the land area is the determining order of the nations, which makes it is easy to compare those, but I find it hard to distinguish between the nations on the other variables, apart from noting which dashed lines are increasing or decreasing.

Regardless, Playfair’s graph makes for a pretty good data visualization, all things considered. None of the data is overly confusing in its presentation. I expect that Playfair would likely feel like he had accomplished the primary objective of highlighting the nations with highest population to revenue proportions (if I am correct about that being the intended communication).

Graph Recreation

#needed to calculate helper variables: approximate radii off the graph
#and find calculation that is close and also had to pick appropriate locations
#for centers of the circles
europe$radii <- sqrt(europe$Area/3.141592)/125
europe$centers <- c(10, 25, 32, 37, 42, 47, 52, 57, 61, 65, 69, 72)

europe %>%
  ggplot() +
  geom_circle(aes(x0 = centers , y0 = 0, r = radii,)) +
  geom_segment(aes(x = centers - radii, xend = centers - radii,
                   y = 0, yend = Population),
               size = 1, color = "red4") +
  geom_segment(aes(x = centers + radii, xend = centers + radii,
                   y = 0, yend = Taxation),
               size = 1, color = "lightgoldenrod")+
  geom_segment(aes(x = centers - radii, xend = centers + radii, 
                   y = Population, yend = Taxation), linetype = "longdash") +
  labs(x = "", y = "",
       title = "Chart representing the Extent, Population, & Revenues, of the Principal Nations in Europe, after the division of Poland & Treaty of Luneville.") +
  coord_fixed() +
  theme(panel.grid.major.x = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.y = element_line(size = 1, color = "black"),
        panel.grid.minor.y = element_line(size = .01, color = "black"),
        axis.ticks.x = element_blank(),
        axis.ticks.y = element_blank(),
        axis.text.x = element_text(angle = 90, face = "italic", hjust = 1, size = 10),
        axis.title.y.right = element_text(angle = 90, face = "italic", hjust = 0.5, size = 12),
        panel.background = element_rect(fill = "bisque2",
                                colour = "bisque2",
                                size = 0.5, linetype = "solid"),
        panel.border = element_rect(colour = "black", fill = NA, linewidth = .1),
        plot.title = element_text(size=15, face = "italic")) +
  scale_x_continuous(breaks = europe$centers, label = levels(europe$Country)) + 
  scale_y_continuous(breaks = seq(0, 30, by = 10),
                     minor_breaks = seq(0, 30, by = 1),
                     sec.axis = sec_axis(trans = ~.*1,
                                         breaks = seq(0, 30, by = 10),
                                         name = "Millions"))

I attempted in my recreation to capture as many elements as possible from the original graph, while using the data source provided as input to the graph. The most fun part to recreate was figure out how to use geom_circle along with geom_segment to get the circles and the lines plotted. After that, the next elements I worked on were all the text and grid lines, which mainly just involved tinkering with random options in theme, at which point I also copied the background color of the original graph. If I were to spend extra time on this, I would estimate each of the inner values of the circles from Playfair’s original graph, which were further breakdowns of each nation and try to incorporate those onto my recreation.

Alternate Graph

europe %>%
  ggplot() +
  geom_bar(mapping = aes(x = Country,
                         y = Population,
                         fill = "Population",
                         width = radii/13),
           stat = "identity",
           alpha = 0.75,
           position = position_nudge(x = europe$radii/10 * 0.15,)) + 
  geom_bar(mapping = aes(x = Country,
                         y = Taxation,
                         fill = "Revenue",
                         width = radii/13),
           stat = "identity",
           alpha = 0.75,
           position = position_nudge(x = europe$radii/10 * -0.15)) +
  labs(x = "", y = "Population (Millions of people) and Revenue (Millions)",
       title = "Chart of European Nation Populations and Revenues in 1801",
       subtitle = "Function of Land Area as Width",
       fill = "Variable") +
  scale_fill_manual(values = c("steelblue", "olivedrab")) +
  theme_bw() +
  scale_x_discrete(labels = paste0(europe$Country, "\n", europe$Area, " sq. miles")) + 
  theme(axis.text.x = element_text(angle = 45, face = "italic", hjust = 1, size = 9))

Conclusion

For my representation of the data, I had three main goals: give a comparable presentation of the same data, make comparing individual variables easier between nations, and reduce the focus on area (as I found that to be the least interesting variable, but the most noticeable on Playfair’s graph). I decided that my primary visual element would be overlapping bars. This ended up serving me very well, as the message about taxes compared to population I think is communicated very easily for each nation. Each nation’s two bars overlap, which while sometimes may be very unappealing, serves the same purpose as Playfair’s dashed-line did originally: draw the eye to the difference in height between each nation’s two bars. In this way, the overlapping bars as the primary element was an excellent choice for maintaining the primary purpose of the visualization. For the land area, I felt that having a large portion of the visualization taken up with big circles representing only that was not very helpful or interesting. Instead, I used the radii data from my previous graph to emulate similar size disparities visually as the original while transferring the data to the element of the bars’ widths. In this way, I achieved less of a focus on the area, while also still making it visually clear how extreme the difference is in land area between the extremes of the data. Spacial organization was the key factor in my consideration of the land area as width element; which parts of the data got the majority of the space was transferred mainly to the more interesting variables, in my opinion.

At the same time, probably the biggest weakness of my version of visualization is that it leaves a bit too much open space. I think the main cause of this is that maintaining the same basic proportion of the space for the area data variable leaves so many of the bars, which are now the primary visual element, taking up very little space. I don’t think this detracts too much from the purpose of the visualization, but it does keep the visualization from being super appealing. If I were to adjust that, I might change the function by which area is represented to be logarithmic instead of radical; this would make the extremes appear even closer than a radical function does, but I think they would still be present enough to be clear while improving the spacial emptiness my graph currently suffers from. The other main weakness is that the units are more noticeably not fully labeled in my graph, at least on the revenue front. Although, I would argue that Playfair failed to note which unit the revenue was in apart from being “millions”, so my graph is no worse on that front.

Overall, though, I think Playfair’s point about taxation in certain countries is very clear: Britain, Spain, and Portugal were notably higher taxers proportionally, while Russia and Turkey were much less. I think my graph also makes it more visually clear the comparison of total revenue between countries: Britain, France, and Spain being the top three, with the others notably lower on the totals.