I'm trying to add title to my circular barplot using ggtitle() but cannot find the title anywhere in the plot. I even tried adjusting the position but of no use. Could someone tell me the issue please? The sample input and code is as below:
grp = c("A","B","C","D","E","F","G","H","I","J")
val= c(104,95,73,65,53,43,30,20,10,5)
data= data.frame(grp,val, stringsAsFactors = TRUE)
ggplot(data, aes(x=grp, y=val)) +
geom_bar(stat="identity", fill=alpha("blue", 0.3)) +
ylim(-100,120) +
theme_minimal() +
theme(
axis.text = element_blank(),
axis.title = element_blank(),
panel.grid = element_blank(),
plot.margin = unit(rep(-2,4), "cm")
) +
coord_polar(start = 0) +
geom_text(aes(x=grp, y=val, label=val+10, vjust=-0.5), color="black", fontface="bold",alpha=0.6, size=2.5, inherit.aes = FALSE ) +
geom_text(aes(x=grp, y=val, label=grp, hjust=2), color="black", fontface="bold",alpha=0.6, size=2.5, inherit.aes = FALSE ) +
ggtitle("Title is top 10")+
theme(plot.title = element_text(hjust = 0.5))