Original


Source: Reddit - r/dataisbeautiful


Objective

This pie chart shows the blood type distribution of the population in USA. There was no specific target audience mentioned for this chart in the source. The target audience of this chart varies based on the purpose it was created for.

The visualisation chosen had the following three main issues:

  • The primary criticism of pie charts is that estimating the magnitude of angles is very hard for the human eye, making the visualization unclear. A solution to this is to either show the percentages of each slice or to use a bar plot.

  • The selection of colors used on the pie chart could be improved. The colors used on visualizations represents more than just the idea, it has the ability to showcase the sort of information you display, its relationship, categorical distinctions, and more.

  • The labels A, B, O and AB on top of each slice of the chart makes it look chaotic and unpresentable. Instead of this, the labels could be replaced by a legend which could make the chart look more presentable.

Reference

Code

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

library(ggplot2)

Blood_Type <- c("O","A","B","AB","O","A","B","AB") 
Percentage <- c(37.4,35.7,8.5,3.4,6.6,6.3,1.5,0.6)
Sign <- c("+ve","+ve","+ve","+ve","-ve","-ve","-ve","-ve")

mydata <-data.frame(Blood_Type, Percentage, Sign)
p <-ggplot(mydata, aes(x = Blood_Type, y = Percentage,  fill = Sign)) +
  geom_bar(stat = "identity",  width = 0.75,  position = "dodge") +
  geom_text(aes(label=Percentage), size=3.5, position=position_dodge(width=0.8), vjust=-0.25) +
  theme_minimal() + labs(title="Blood Type Distribution in the United States", caption = "Data source: Wikipedia",  x = "Blood Type", y = "Percentage")
p1 <- p + theme(
  plot.title = element_text(hjust = 0.5, lineheight = 2, size = 12, face = "bold", color = "black"),  
  plot.caption = element_text(hjust = 0)
)

Data Reference

Reconstruction

The following plot fixes the main issues in the original.