Circular Bar Plot of Government Budget Allocation

Introduction

  • Government budgets involve complex distributions across various sectors
  • Visualizing these distributions helps citizens and policymakers understand priorities
  • This project visualizes budget percentage allocation using a circular bar plot

Objective

  • To analyze the distribution of a national government budget
  • To visualize sector-wise allocation percentages clearly
  • To use a radial layout to emphasize the “whole” of the budget

Data Source

  • Data represents a standard fiscal year budget distribution
  • Sectors include Education, Health, Defense, and Infrastructure
  • Values are approximated based on typical annual budget reports

Data Loading

  • Dataset can be stored as a CSV or defined as a data frame
  • Loaded into R using read.csv() or data.frame()
  • Data contains:
    • Sector Names
    • Percentage Allocation

Data Cleaning

  • Sector names are treated as categorical factors
  • Data is sorted by percentage to create a smooth “spiral” effect
  • Ensured that total allocation represents 100% of the budget

Data Transformation

  • The Y-axis (percentages) is prepared for a radial transformation
  • An “offset” is added to the Y-axis limits
  • This offset creates the empty circle (the “donut hole”) in the middle

Feature Engineering

  • Calculated label positions for each bar
  • Sectors are assigned distinct colors for better visual separation
  • Theme elements are stripped to provide a clean, infographic-style look

Visualization

The circular bar plot uses polar coordinates to transform standard bars into a radial display. This provides an aesthetic, dashboard-ready view of how the total budget is carved up across different government priorities.

# 1. Load library
library(ggplot2)

# 2. Create/Load dataset 
data <- data.frame(
  sector = c("Education", "Healthcare", "Defense", "Infrastructure", 
             "Social Welfare", "Technology", "Agriculture", "Others"),
  percentage = c(25, 20, 15, 12, 10, 8, 6, 4)
)

# 3. Data Cleaning: Sort by percentage for a better visual spiral
data <- data[order(data$percentage, decreasing = TRUE), ]

# 4. Visualization: Build the Circular Bar Plot
ggplot(data, aes(x = sector, y = percentage, fill = sector)) +
  geom_bar(stat = "identity", width = 0.8) +
  coord_polar(start = 0) +
  ylim(-10, 30) +
  geom_text(aes(label = paste0(percentage, "%")), 
            position = position_stack(vjust = 0.5), 
            color = "white", fontface = "bold") +
  theme_minimal() +
  theme(
    axis.text = element_blank(),
    axis.title = element_blank(),
    panel.grid = element_blank(),
    legend.position = "right"
  ) +
  labs(
    title = "Annual Budget Distribution",
    subtitle = "Percentage Allocation per Sector",
    fill = "Sectors"
  )