Mind the radial bar charts

A collection of common dataviz caveats by Data-to-Viz.com




A radial bar chart is basically a bar chart plotted in polar coordinates instead of a Cartesian plane.
Here is one showing the quantity of weapons exported by the top 6 largest exporters in 2017. (You can read more about this story here).

# Libraries
library(tidyverse)
library(hrbrthemes)

# Load dataset from github
data <- read.table("https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/7_OneCatOneNum.csv", header=TRUE, sep=",")

# plot
data %>%
  filter(!is.na(Value)) %>%
  arrange(Value) %>%
  tail(6) %>%
  mutate(Country=factor(Country, Country)) %>%
  ggplot( aes(x=Country, y=Value) ) +
    geom_bar(fill="#69b3a2", stat="identity") +
    geom_text(hjust = 1, size = 3, aes( y = 0, label = paste(Country," "))) +
    theme_ipsum() +
    theme(
      panel.grid.minor.y = element_blank(),
      panel.grid.major.y = element_blank(),
      legend.position="none",
      axis.text = element_blank()
    ) +
    xlab("") +
    ylab("") +
    coord_polar(theta = "y") +
    ylim(0,15000) 

The good thing about this kind of graphic is that it is quite eye-catching. However, because the bars are plotted on different radial points of the polar axis, they have different radii and cannot be compared by their lengths. A bar on the outside will be longer by construction than one on the inside, even with an equal value.

note: Other issues exist on this graphic, like the lack of a Y-axis. It is made for illustration purposes only.

This radial issue is well illustrated on this post from VisualizingData.com:



img
Source: VisualizingData.com



Workaround


Becauses of these issues, radial bar charts should be avoided. Instead, you can build a standard bar chart or lollipop plot to display the information more accurately:

data %>%
  filter(!is.na(Value)) %>%
  arrange(Value) %>%
  mutate(Country=factor(Country, Country)) %>%
  ggplot( aes(x=Country, y=Value) ) +
    geom_segment( aes(x=Country ,xend=Country, y=0, yend=Value), color="grey") +
    geom_point(size=3, color="#69b3a2") +
    coord_flip() +
    theme_ipsum() +
    theme(
      panel.grid.minor.y = element_blank(),
      panel.grid.major.y = element_blank(),
      legend.position="none"
    ) +
    xlab("")

You can see more ways to represent this dataset here.

Going further


Comments


Any thoughts on this? Found any mistake? Disagree? Please drop me a word on twitter or in the comment section below:

 

A work by Yan Holtz for data-to-viz.com