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

Original


Source: Polymersearch.


Objective

The main objective of the source is to show the CO2 emissions of different countries.

The visualisation chosen had the following three main issues:

Issue 1: Pie charts are best used when there are 2-3 items that make up a whole. Issue 2: Any more than that, and it’s difficult for the human eye to distinguish between the parts of a circle. Issue 3: Notice how it’s hard to distinguish the size of these parts. Is “China” bigger than “Other”? It’s hard for our eyes to tell the difference.

Reference

Gupta, A. (2022). 10 Good and Bad Examples of Data Visualization · Polymer. [online] Polymer. Available at: https://www.polymersearch.com/blog/10-good-and-bad-examples-of-data-visualization.

Code

The following code was used to fix the issues identified in the original. # Load the library library(ggplot2)

Create a sample data frame with pie chart data

chart_data <- data.frame( Category = c(“China”, “US”, “EEA”, “India”, “Russia”, “Japan”, “Other”), Value = c(29.40, 14.3, 9.8, 6.8, 4.9, 3.5, 31.5) )

Convert pie chart data to bar chart data

bar_data <- transform(chart_data, EndValue = cumsum(Value), StartValue = lag(EndValue, default = 0))

Create the bar chart

bar_plot <- ggplot(bar_data, aes(x = 1, y = Value, fill = Category)) + geom_bar(stat = “identity”, width = 1, color = “red”) + coord_flip() + theme_minimal() + labs(x = NULL, y = NULL, title = “Bar Chart”)

Display the bar chart

print(bar_plot)

Data Reference * Gupta, A. (2022). 10 Good and Bad Examples of Data Visualization · Polymer. [online] Polymer. Available at: https://www.polymersearch.com/blog/10-good-and-bad-examples-of-data-visualization.

Reconstruction


Source: Polymersearch.


The following plot fixes the main issues in the original.

# Convert pie chart data to bar chart data
bar_data <- transform(chart_data, EndValue = cumsum(Value), StartValue = lag(EndValue, default = 0))

In the reconstructed plot, several improvements have been made to address the issues identified in the original visualization:

Issue 1: Bar charts can be used to represent more than 3 categories. Issue 2: Human eye can easily distinguish between different parts of the bar charts. Issue 3: “China” and “Other” are far apart, but we can easily distinguish that one is larger than the other? That’s because our eyes are more sensitive to length of bars than parts of a circle.

Overall, the reconstruction enhances the clarity and effectiveness of the visualization, allowing the audience to understand the data more easily.