Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.
Objective
In One Chart: State Tax Revenue by Source was created by Juan Carlos and published on 11 November 2019 by HowMuch.net. The objective of the visualisation is to display the different types and amounts of tax revenue the US Government received from all 50 states in 2018. The values represented in the visualisation are cumulative revenue totals for 25 different taxes.
The target audience for this visualisation is individuals or corporations interested in the impact of the wealth tax plan proposed by Democratic presidential candidate Elizabeth Warren.
Using the visualisation, Carlos (2019) has attempted to represent that the most significant source comes from the overrepresented revenue of income taxes. However, the remainder of the top five revenue sources is not present in the plan.
Carlos (2019) argues that adding additional tax to wealthy individuals may not provide funding for the proposed programs and that there are other potential sources of revenue the wealth tax plan does not acknowledge and could help pay down the federal debt.
The visualisation chosen had the following three main issues:
References
The following code was used to fix the issues identified in the original.
# Load libraries
library(ggplot2)
library(dplyr)
library(ragg)
library(rsconnect)
# Import data set
onechart <- read.csv("in_one_chart.csv")
# Check structure of data frame
str(onechart)
## 'data.frame': 25 obs. of 4 variables:
## $ tax : chr "Property Taxes" "General Sales and Gross Receipts Taxes" "Alcoholic Beverages Sales Tax" "Amusements Sales Tax" ...
## $ amount : int 20079471 317422936 6795036 8151881 22457399 48262883 125587 12549600 19502424 47124945 ...
## $ percent: num 0.0195 0.3079 0.0066 0.0079 0.0218 ...
## $ type : chr "Property taxes" "General Sales Taxes" "Selective Sales Taxes" "Selective Sales Taxes" ...
# Convert type to factor
onechart$type <- as.factor(onechart$type)
# Confirm factor conversion
str(onechart)
## 'data.frame': 25 obs. of 4 variables:
## $ tax : chr "Property Taxes" "General Sales and Gross Receipts Taxes" "Alcoholic Beverages Sales Tax" "Amusements Sales Tax" ...
## $ amount : int 20079471 317422936 6795036 8151881 22457399 48262883 125587 12549600 19502424 47124945 ...
## $ percent: num 0.0195 0.3079 0.0066 0.0079 0.0218 ...
## $ type : Factor w/ 6 levels "General Sales Taxes",..: 5 1 6 6 6 6 6 6 6 6 ...
# Convert data into 2 decimal format
onechart$percent <- onechart$percent*100 %>% round(digits = 2)
# Generate horizontal bar chart
p1 <- ggplot(data = onechart, mapping = aes(x=reorder(tax, percent), y=percent)) # Load data into plot
p1 <- p1 + geom_bar(stat = "identity", aes(fill = type), # Select bar chart geom aesthetic
position = position_nudge(y = -1.5)) + # Adjust plot y axis position
coord_flip() + # flip the x axis to display horizontal
labs(title = "A Breakdown of all States' Taxes Revenue", # Add title label
subtitle = "Taxes Revenue was $1.031 Trillion in 2018", # Add subtitle label
y = "Percent (%) of Taxes Revenue by Category", # Add axis label
fill = "Tax Type") # Add legend label
p1 <- p1 + geom_text(aes(label=paste0(percent, "%")), size = 3) + # Add data labels
theme(plot.title = element_text(size = 20, face = "bold", hjust=-4.75)) + # Make plot title 20pt and bold
theme(plot.subtitle = element_text(size = 16, face = "bold", hjust=-1.68)) + # Make plot subtitle 16pt and bold
theme(axis.ticks.x=element_blank(), axis.text.x=element_blank(), # Remove axis ticks and text
axis.title.x = element_text(face = "bold")) + # Make x axis label bold
theme(axis.title.y=element_blank(), # Remove y axis title text
axis.text.y = element_text(face = "bold")) + # Make y axis labels bold
theme(panel.grid.major = element_blank(), # Remove plot grid lines
panel.grid.minor = element_blank(), # Remove plot grid lines
panel.border = element_blank(), # Remove plot border lines
panel.background = element_blank()) # Remove plot background
p1 <- p1 + theme(legend.position = c(.975, .5), # Adjust legend position
legend.justification = "right", # Right alight legend content
legend.text = element_text(size = 7), # Adjust legend text size
legend.title = element_text(size = 9)) # Adjust legend title size
p1 <- p1 + scale_fill_manual(values = c("#88CCEE", "#999933", "#661100", "#117733", "#332288", "#AA4499",
"#44AA99")) # Add colour-blind palette
Data Reference
The following plot fixes the main issues in the original.