Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.
SOURCE
: OECD TOTAL TAX REVENUE BY MEMBER COUNTRIES
Objective
The above visualization is an overview of several tax categories for OECD member nations, indicating that there are numerous ways to generate revenue and compare total revenue among countries.
The visualization chosen had the following three main issues:
Reference
The following code was used to fix the issues identified in the original.
library(ggplot2)
library(tidyverse)
Data <- read.csv(file = 'TaxData.csv')
df <- as.data.frame(Data)
df %>% head()
colnames(df) <- c('Country','TR','ITR','COR_TR','STR','PTR','CON_TR','OTR','TRG')
#df <- df[1:20,]
df <- df %>% pivot_longer(cols = c('TR'), names_to = "Tax_Revenue", values_to = 'Values')
p <- ggplot(df) +
geom_bar(aes(x = Country, y = Values, fill = Tax_Revenue ), stat = "identity", width = 0.3,position = "dodge") +
ggtitle("Overall Tax Revenue in Different Countries") +
theme_grey() +
theme(legend.title = element_text(size = 6),
legend.text = element_text(size = 6),
legend.background = element_rect(size=0.5),
plot.title = element_text(size=6, face="bold",hjust = 0.8),
axis.title.x = element_text(size=6, face="bold"),
axis.title.y = element_text(size=6, face="bold"),
axis.text.x = element_text(size=6,angle = 90, vjust = 0.5, hjust=1),
axis.text.y = element_text(size=6, hjust=1),
strip.text.y = element_blank(),
strip.background = element_blank(),
panel.border = element_blank() ) +
coord_flip()
p
Data Reference
The following plot fixes the main issues in the original.