# 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"
)