Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.
Objective
The visualisation chosen had the following three main issues:
The pie charts proportions are not evenly scaled, since pie charts use both area and angles for depiction,in this case we can see the difference in areas,the angles however seem to hardly differ. Visually it seems that Infrastructure Business (47%) and Power(3%) share almost the same angle.
The variable labels are not consistently placed, the least contributors are mentioned outside the chart while the large contributors are mentioned inside the chart, the orientation of the variables are not consistent too, for example Development project,financial service have different orientation.
The bright colors used here especially red,purple and dark blue is not suitable for color-blind audiences.
Reference
The following code was used to fix the issues identified in the original.
# load library
library(ggplot2)
library(ggeasy)
# Create test data.
data <- data.frame(
sector=c("Infrastructure Business","Information Technology","Hydrocarbon",
"Financial Service","Power","Development Project","Defense Engineering",
"Heavy Engineering","Other"),
contribution=c(47,21,13,8,3,3,2,1,2)
)
data_base<-ggplot(data = data,aes(x=reorder(sector,contribution),
y=contribution))
data_base<-data_base+geom_bar(stat = "identity",colour="Black",
fill=c("#6FD6FF","#FCEE21","#A9F1DF","#FFC371","#38EF7D","#ffecd2",
"#A890FE","#C6EA8D","#E2D1B3"))+scale_y_continuous(expand = c(0, 0))
data_base<-data_base+geom_text(aes(label=contribution),size=4,vjust=+0.3,hjust=+1.0)+coord_flip()
data_base<-data_base+theme_classic()+scale_fill_viridis_d()
data_base<-data_base+theme(legend.position = "none",axis.text.x = element_text(size = 10),
panel.background = element_rect(fill = "white"))
data_base<-data_base+ggeasy::easy_rotate_labels(which = "x",angle = 0)
data_base<-data_base+labs(x="Business sector",y="Percentage contribution")+
theme(axis.title.x = element_text(size = 15),axis.title.y = element_text(size = 15))
data_base<-data_base+labs(title ="Revenue contribution of each sector in percentage for FY 2022")+
theme(plot.title =element_text(hjust = 0.6))
data_base<-data_base+theme(plot.subtitle = element_text(hjust = 0.5))
Data Reference
https://www.reddit.com/r/dataisugly/comments/1193e14/pie_chart_where_the_size_of_each_slice_is_not/
The following plot fixes the main issues in the original.
data_base