I've found and been guided to numerous post showing how to place stats above all bars in a barplot in ggplot, but I haven't found one that shows how to only show the count/percentage above only one bar in the barplot.
- How to put labels over geom_bar for each bar in R with ggplot2
- How to put labels over geom_bar in R with ggplot2
- Annotation above bars:
- How to add percentage or count labels above percentage bar plot?
For example with the following plot:
ggplot(mtcars, aes(x = gear)) + geom_bar() +
geom_text(stat='count',aes(label=..count..),vjust=-1)
how could I just print "12" above the middle bar and supress printing "5" and "15". The bar I'd like to show the count above will vary from plot to plot (e.g. in another plot I'd like to show the stat above the 4th largest out of 5 bars).
""
for the positions where you don't want values. And ... What about "How do I manually set geom_bar fill color in ggplot"? – IRTFM