I am trying to prepare a bar plot with the following code below. This is a grouped bar chart of number of services performed by sex for each year. My goal is to have a barplot similar to this
Below is the code I have tried and it produces the image below.
ggplot(data=dfhips, aes(x=year, y=Tot_Srvcs, fill=Rndrng_Prvdr_Gndr)) +
geom_bar(stat="identity", position=position_dodge())+
geom_text(aes(label=Tot_Srvcs), vjust=1.6, color="white",
position = position_dodge(0.9), size=3.5)
This is the str for the 3 columns I am trying to plot
'data.frame': 34940 obs. of 3 variables:
$ year : chr "2013" "2013" "2013" "2013" ...
$ Tot_Srvcs : int 14 17 30 11 13 16 102 15 30 30 ...
$ Rndrng_Prvdr_Gndr: chr "M" "M" "M" "M" ...
Please how can i have only one label appear for each bar/category?