Hi I have been trying to summarize my data set by sum of a particular column and using ggplot and geom_bar() directly to do so instead of using tidyvers and dplyr libraries.
I read about weight aesthetic and that it can help plotting bar graph as sum of a particular feature instead of count and it worked.
Problem is I am unable to plot the y value on top of the bars as I do not know how should I write geom_text(????) code:
p1<-ggplot(df, aes(x= ageBracket, fill= movement, **weight= amount**))+ geom_bar(width= 0.5, position= 'dodge')+ theme_hc()+scale_x_discrete('Age Group', limits=c("16 to 25 years", "26 to 35 years", "36 to 45 years", "> 46 years"))+ theme(legend.position= "bottom",legend.background = element_rect(fill="lightblue", size=0.2, linetype="solid"))+ scale_fill_brewer(palette = "Dark2")+ scale_y_continuous("Amount per Age Group",labels = comma)+ **geom_text(?????)**
print(p1)
Blockquote
Here fill has helped me to segregate the bars that I have dodged, weight has helped me to sum data based on the filters of : movement & ageBracket, I just want the y axis values on top of the respective bar and not want to create a separate data frame. What should I do ??