I am looking to add labels to a bar graph and omit 0's. Right now it's a mess to read. I would also like the labels to appear over the bars and have the labels positioned either on or above the bars. I've been able to adjust the label heights but as I'm plotting a ratio the scale on the y axis could vary which is a challenge. This is the graph so far
A <- c('A','B','C','D','E')
HQ <- c(0,0,0.2,0,0.5)
Category <-c(1,2,1,1,2)
HIData <-data.frame(A,HQ,Category)
Ainorder<- c('B','C','D','A','E')
Listofcolors <- c("A"="red","B"="red","C"="blue","D"="red","E"="blue")
HIPlot <- ggplot(data=HIData, aes(x=factor(A,level=Ainorder),y=HQ))+ geom_col()
HIPlot <- HIPlot + theme(panel.grid.major=element_blank(),panel.grid.minor=element_blank())
HIPlot <- HIPlot + theme(axis.text.x = element_text(angle=90,vjust=0.5, color = Listofcolors),axis.text.y=element_text(angle=0,vjust=0.5,color = "black"))
HIPlot <- HIPlot + ylab("HQ")+xlab("")+ labs(title=paste0(first("HQ for "),HIData$ID))
HIPlot <- HIPlot + aes(fill=Category)
HIPlot <- HIPlot + geom_text(data=HIData, aes(label=HQ), angle=90)
HIPlot