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

Original


Source: Visualizing Car Insurance Rate by State in 2020


Objective

  • The visualization provides the insights about the significant price difference between the full and the minimum cover car insurance in each of the respective states in US.

Targeted Audience

  • The price of car insurance in each state corresponds to the government laws. So the targeted audience will be Customers(US citizens who buy a car), insurance companies, government bodies.

The visualization chosen had the following three main issues:

No Basic visualization Conventions:

  • The visualization does not have a standard scaling. There is no X-axis or Y-axis, so it becomes difficult to get insights from the data.

Difference between the price for insurance cover:

  • The main intention of the visualization is to display the price difference between the car insurance cover for full and minimum cover but in the visualization the price difference is not displayed, rather the price of full and medium insurance cover are displayed in each state.

Comparing the price difference and state abbreviation:

  • It becomes difficult to compare the price difference(Full cover - Minimum cover) in each of the states as the exact value of the price difference is not displayed and each of the states are displayed in corresponding circles of amount 2000$ to 8000$ which is difficult to analyse in the visualization and the state names are abbreviated rather than providing the complete name of the state.

Reference

Code

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

library(ggplot2)
library(readr)
insurance <- read_csv("insurance_1.csv")

my_cols1 <- c("Full coverage", "Minimum coverage")

insurance$Price_diff <- do.call(paste, c(insurance[my_cols1], sep = "-"))

# combine the price diff column and state
my_cols <- c("State", "Price_diff")

insurance$Price_state <- do.call(paste, c(insurance[my_cols], sep= " "))

# remove the reamining columns

insurance <- insurance[, ! colnames(insurance) %in% c(my_cols, my_cols1)]

p1 <- ggplot(insurance, aes(x = Difference, y = reorder(Price_state,Difference),)) + geom_col(fill = '#003366', color = 'red')+  geom_text(aes(label = Difference, vjust = 1,
hjust = 0))+ 
  theme(axis.text.y = element_text(size = 9), plot.title = element_text(size = 12,face = "bold"), axis.text=element_text(size=8, face = "bold"),
        axis.title=element_text(size=10,face="bold"))+
  labs(title = "The difference in price for car insurance cover in each state",
      x = "Price Difference $(Full cover - Minimum Cover)",
      y = "Insurance Price Per State(Full cover , Minimum Cover)")

Data Reference

Reconstruction

The following plot fixes the main issues in the original.